@agenthippo-ai/agenthippo 1.110.11 → 1.110.19

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 (534) hide show
  1. package/out/agentpack/types.js +2 -5
  2. package/out/analytics/dashboard/artifactManager.js +2 -439
  3. package/out/analytics/dashboard/fleetDisplayUtils.js +2 -162
  4. package/out/analytics/dashboard/fleetOrchestrator.js +3 -142
  5. package/out/analytics/dashboard/fleetRegistry.js +2 -79
  6. package/out/analytics/dashboard/fleetRowDefaults.js +2 -87
  7. package/out/analytics/dashboard/fleetScriptAdapter.js +2 -146
  8. package/out/analytics/dashboard/fleetTypes.js +2 -29
  9. package/out/analytics/dashboard/index.js +2 -17
  10. package/out/analytics/dashboard/indexingService.js +2 -422
  11. package/out/analytics/dashboard/localFleetAdapter.js +2 -302
  12. package/out/analytics/dashboard/performanceMonitor.js +5 -76
  13. package/out/analytics/dashboard/processManager.js +2 -209
  14. package/out/analytics/dashboard/provider.js +38 -3817
  15. package/out/analytics/dashboard/queryRunner.js +62 -750
  16. package/out/analytics/dashboard/scheduledFleetStorage.js +2 -241
  17. package/out/analytics/dashboard/sessionJsonlFleet.js +3 -204
  18. package/out/analytics/dashboard/teamViewDiscovery.js +2 -106
  19. package/out/analytics/dashboard/webview/panel.js +34 -2318
  20. package/out/analytics/dashboard/webview/runtime-bridge.js +2 -82
  21. package/out/analytics/lifecycle.js +2 -43
  22. package/out/analytics/service.js +8 -1283
  23. package/out/auth/authBaseUrl.js +2 -59
  24. package/out/auth/bootstrapApply.js +2 -71
  25. package/out/auth/brokerClient.js +2 -160
  26. package/out/auth/callbackUri.js +2 -59
  27. package/out/auth/githubStoreGate.js +2 -70
  28. package/out/auth/loopbackAuthServer.js +4 -159
  29. package/out/auth/onboardingPrompt.js +2 -112
  30. package/out/auth/pkce.js +2 -9
  31. package/out/auth/provider.js +2 -226
  32. package/out/auth/sessionStore.js +2 -156
  33. package/out/auth/signInFlow.js +2 -183
  34. package/out/cli/index.js +617 -564
  35. package/out/cli/run-custom-engine-runner.js +3 -318
  36. package/out/cli/vscode-shim.js +2 -86
  37. package/out/engines/factory.js +2 -45
  38. package/out/engines/types.js +2 -17
  39. package/out/examples/run-headless-repl.js +6 -286
  40. package/out/examples/run-headless.js +2 -187
  41. package/out/extension.js +32 -4473
  42. package/out/gateway/gatewayRouteIndex.js +6 -371
  43. package/out/gateway/gatewaySessionStore.js +3 -243
  44. package/out/gateway/index.js +2 -31
  45. package/out/gateway/resetMappings.js +2 -52
  46. package/out/gateway/service.js +5 -1249
  47. package/out/mcp/publish.js +2 -143
  48. package/out/remote/handleRemoteChat.js +2 -169
  49. package/out/remote/remotePackStatusBar.js +3 -103
  50. package/out/remote/remoteTrust.js +6 -277
  51. package/out/remote/serveClient.js +4 -277
  52. package/out/remoteSkills.js +3 -191
  53. package/out/runtime/index.js +2 -32
  54. package/out/runtime/vscode/index.js +2 -20
  55. package/out/runtime/vscode/vscode-config-provider.js +2 -77
  56. package/out/runtime/vscode/vscode-edit-tracker.js +2 -122
  57. package/out/runtime/vscode/vscode-logger.js +2 -30
  58. package/out/runtime/vscode/vscode-permission-handler.js +2 -72
  59. package/out/scripts/agentide-litellm.sh +0 -1
  60. package/out/scripts/agentide_litellm_hooks_v1.py +127 -459
  61. package/out/scripts/analytics/agent-fleet-widget.js +18 -257
  62. package/out/scripts/analytics/agentide-litellm-otel.config.yaml +0 -4
  63. package/out/scripts/analytics/duckdbLocator.js +2 -28
  64. package/out/scripts/analytics/generate-default-charts.py +43 -323
  65. package/out/scripts/analytics/hotspot-analysis-widget.js +4 -430
  66. package/out/scripts/analytics/index-traces.py +78 -1036
  67. package/out/scripts/analytics/session-comparison-widget.js +26 -472
  68. package/out/scripts/analytics/session-timeline-widget.js +25 -846
  69. package/out/scripts/analytics/token-cost-flamegraph-widget.js +4 -461
  70. package/out/scripts/analytics/token-cost-trend-widget.js +4 -534
  71. package/out/scripts/analytics/workflows-collector.cjs +4 -314
  72. package/out/scripts/analytics/workflows-daemon.mjs +9 -185
  73. package/out/scripts/analytics/workflows-widget.cjs +15 -159
  74. package/out/scripts/analytics/wow-model-widget.js +10 -120
  75. package/out/scripts/vendor-tools.mjs +2 -233
  76. package/out/skills/publish.js +3 -178
  77. package/out/store/github/setup.js +7 -212
  78. package/out/store/oramaIndex.js +2 -884
  79. package/out/sync.js +26 -1829
  80. package/out/terminalLogger.js +5 -358
  81. package/out/utils/pathSafety.js +2 -60
  82. package/out/utils/pythonRunner.js +4 -258
  83. package/out/utils/toolPath.js +2 -83
  84. package/out/workspaceFolders.js +2 -59
  85. package/package.json +1 -1
  86. package/out/agentpack/github.js +0 -547
  87. package/out/agentpack/index.js +0 -69
  88. package/out/agentpack/install.js +0 -297
  89. package/out/agentpack/manager.js +0 -441
  90. package/out/agentpack/manifest.js +0 -135
  91. package/out/agentpack/paths.js +0 -521
  92. package/out/agentpack/publish.js +0 -248
  93. package/out/agentpack/stores.js +0 -554
  94. package/out/analytics/dashboard/fleetStatusUtils.js +0 -30
  95. package/out/analytics/dashboard/fleetTitleUtils.js +0 -68
  96. package/out/analytics/dashboard/refreshPolicy.js +0 -16
  97. package/out/analytics/dashboard/scheduledFleetFingerprint.js +0 -22
  98. package/out/analytics/dashboard/scheduledFleetUtils.js +0 -22
  99. package/out/analytics/dashboard/sessionEventFleetStats.js +0 -118
  100. package/out/analytics/dashboard/viewsConfigMerge.js +0 -221
  101. package/out/analytics/dashboard/webview/codicon.ttf +0 -0
  102. package/out/analytics/identity.js +0 -0
  103. package/out/analytics/sessionEvents.js +0 -324
  104. package/out/auth/callbackUriParse.js +0 -59
  105. package/out/auth/types.js +0 -12
  106. package/out/auth-broker/config.js +0 -112
  107. package/out/auth-broker/jwt.js +0 -105
  108. package/out/auth-broker/pkce.js +0 -59
  109. package/out/auth-broker/server.js +0 -681
  110. package/out/auth-broker/store.js +0 -275
  111. package/out/authority/warrant.js +0 -206
  112. package/out/base-prompts/mcp-servers/.mcp.json +0 -13
  113. package/out/base-prompts/mcp-servers/langfuse-analytics/README.md +0 -142
  114. package/out/base-prompts/mcp-servers/langfuse-analytics/mcp.json +0 -13
  115. package/out/base-prompts/mcp-servers/langfuse-analytics/package-lock.json +0 -1192
  116. package/out/base-prompts/mcp-servers/langfuse-analytics/package.json +0 -23
  117. package/out/base-prompts/mcp-servers/langfuse-analytics/scripts/run-with-env.sh +0 -12
  118. package/out/base-prompts/mcp-servers/langfuse-analytics/scripts/sdk-test.js +0 -102
  119. package/out/base-prompts/mcp-servers/langfuse-analytics/scripts/simple-test.js +0 -137
  120. package/out/base-prompts/mcp-servers/langfuse-analytics/scripts/test-client.js +0 -118
  121. package/out/base-prompts/mcp-servers/langfuse-analytics/scripts/test-server.js +0 -209
  122. package/out/base-prompts/mcp-servers/langfuse-analytics/src/client.ts +0 -431
  123. package/out/base-prompts/mcp-servers/langfuse-analytics/src/index.ts +0 -270
  124. package/out/base-prompts/mcp-servers/langfuse-analytics/tsconfig.json +0 -18
  125. package/out/base-prompts/rules/AGENTS.md +0 -204
  126. package/out/base-prompts/skills/agent-browser/SKILL.md +0 -102
  127. package/out/base-prompts/skills/agent-builder/SKILL.md +0 -73
  128. package/out/base-prompts/skills/agent-builder/references/agent-pack.md +0 -63
  129. package/out/base-prompts/skills/agent-builder/references/crewai.md +0 -66
  130. package/out/base-prompts/skills/agent-builder/references/langchain.md +0 -60
  131. package/out/base-prompts/skills/agent-builder/references/raw-sdk.md +0 -73
  132. package/out/base-prompts/skills/agent-engine-creator/SKILL.md +0 -586
  133. package/out/base-prompts/skills/agent-engine-installer/SKILL.md +0 -106
  134. package/out/base-prompts/skills/agent-engine-installer/scripts/install-engine.mjs +0 -259
  135. package/out/base-prompts/skills/agent-engine-installer/scripts/install-engine.ps1 +0 -189
  136. package/out/base-prompts/skills/agenthippo-cli/SKILL.md +0 -69
  137. package/out/base-prompts/skills/agenthippo-cli/scripts/install.sh +0 -63
  138. package/out/base-prompts/skills/agentpack-creator/SKILL.md +0 -375
  139. package/out/base-prompts/skills/agentpack-creator/references/agent-templates.md +0 -261
  140. package/out/base-prompts/skills/agentpack-creator/references/agents-md-guide.md +0 -195
  141. package/out/base-prompts/skills/agentpack-creator/scripts/init_pack.py +0 -391
  142. package/out/base-prompts/skills/agentpack-creator/scripts/init_pack_test.py +0 -294
  143. package/out/base-prompts/skills/agentpack-testbench/SKILL.md +0 -135
  144. package/out/base-prompts/skills/algorithmic-art/LICENSE.txt +0 -202
  145. package/out/base-prompts/skills/algorithmic-art/SKILL.md +0 -405
  146. package/out/base-prompts/skills/algorithmic-art/templates/generator_template.js +0 -223
  147. package/out/base-prompts/skills/algorithmic-art/templates/viewer.html +0 -599
  148. package/out/base-prompts/skills/debug-agent/SKILL.md +0 -83
  149. package/out/base-prompts/skills/desktop-automation/SKILL.md +0 -166
  150. package/out/base-prompts/skills/desktop-automation/references/agenthippo-ui-recipes.md +0 -441
  151. package/out/base-prompts/skills/desktop-automation/scripts/windows-desktop-uia.psm1 +0 -280
  152. package/out/base-prompts/skills/docx/LICENSE.txt +0 -30
  153. package/out/base-prompts/skills/docx/SKILL.md +0 -197
  154. package/out/base-prompts/skills/docx/docx-js.md +0 -350
  155. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +0 -1499
  156. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +0 -146
  157. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +0 -1085
  158. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +0 -11
  159. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +0 -3081
  160. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +0 -23
  161. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +0 -185
  162. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +0 -287
  163. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +0 -1676
  164. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +0 -28
  165. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +0 -144
  166. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +0 -174
  167. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +0 -25
  168. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +0 -18
  169. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +0 -59
  170. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +0 -56
  171. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +0 -195
  172. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +0 -582
  173. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +0 -25
  174. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +0 -4439
  175. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +0 -570
  176. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +0 -509
  177. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +0 -12
  178. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +0 -108
  179. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +0 -96
  180. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +0 -3646
  181. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +0 -116
  182. package/out/base-prompts/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +0 -42
  183. package/out/base-prompts/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +0 -50
  184. package/out/base-prompts/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +0 -49
  185. package/out/base-prompts/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +0 -33
  186. package/out/base-prompts/skills/docx/ooxml/schemas/mce/mc.xsd +0 -75
  187. package/out/base-prompts/skills/docx/ooxml/schemas/microsoft/wml-2010.xsd +0 -560
  188. package/out/base-prompts/skills/docx/ooxml/schemas/microsoft/wml-2012.xsd +0 -67
  189. package/out/base-prompts/skills/docx/ooxml/schemas/microsoft/wml-2018.xsd +0 -14
  190. package/out/base-prompts/skills/docx/ooxml/schemas/microsoft/wml-cex-2018.xsd +0 -20
  191. package/out/base-prompts/skills/docx/ooxml/schemas/microsoft/wml-cid-2016.xsd +0 -13
  192. package/out/base-prompts/skills/docx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +0 -4
  193. package/out/base-prompts/skills/docx/ooxml/schemas/microsoft/wml-symex-2015.xsd +0 -8
  194. package/out/base-prompts/skills/docx/ooxml/scripts/pack.py +0 -159
  195. package/out/base-prompts/skills/docx/ooxml/scripts/unpack.py +0 -29
  196. package/out/base-prompts/skills/docx/ooxml/scripts/validate.py +0 -69
  197. package/out/base-prompts/skills/docx/ooxml/scripts/validation/__init__.py +0 -15
  198. package/out/base-prompts/skills/docx/ooxml/scripts/validation/base.py +0 -951
  199. package/out/base-prompts/skills/docx/ooxml/scripts/validation/docx.py +0 -274
  200. package/out/base-prompts/skills/docx/ooxml/scripts/validation/pptx.py +0 -315
  201. package/out/base-prompts/skills/docx/ooxml/scripts/validation/redlining.py +0 -279
  202. package/out/base-prompts/skills/docx/ooxml.md +0 -610
  203. package/out/base-prompts/skills/docx/scripts/__init__.py +0 -1
  204. package/out/base-prompts/skills/docx/scripts/document.py +0 -1276
  205. package/out/base-prompts/skills/docx/scripts/templates/comments.xml +0 -3
  206. package/out/base-prompts/skills/docx/scripts/templates/commentsExtended.xml +0 -3
  207. package/out/base-prompts/skills/docx/scripts/templates/commentsExtensible.xml +0 -3
  208. package/out/base-prompts/skills/docx/scripts/templates/commentsIds.xml +0 -3
  209. package/out/base-prompts/skills/docx/scripts/templates/people.xml +0 -3
  210. package/out/base-prompts/skills/docx/scripts/utilities.py +0 -374
  211. package/out/base-prompts/skills/gateway-outbound/SKILL.md +0 -136
  212. package/out/base-prompts/skills/mcp-builder/LICENSE.txt +0 -202
  213. package/out/base-prompts/skills/mcp-builder/SKILL.md +0 -328
  214. package/out/base-prompts/skills/mcp-builder/reference/evaluation.md +0 -602
  215. package/out/base-prompts/skills/mcp-builder/reference/mcp_best_practices.md +0 -249
  216. package/out/base-prompts/skills/mcp-builder/reference/node_mcp_server.md +0 -970
  217. package/out/base-prompts/skills/mcp-builder/reference/python_mcp_server.md +0 -719
  218. package/out/base-prompts/skills/mcp-builder/scripts/connections.py +0 -151
  219. package/out/base-prompts/skills/mcp-builder/scripts/evaluation.py +0 -373
  220. package/out/base-prompts/skills/mcp-builder/scripts/example_evaluation.xml +0 -22
  221. package/out/base-prompts/skills/mcp-builder/scripts/requirements.txt +0 -2
  222. package/out/base-prompts/skills/openclaw/SKILL.md +0 -406
  223. package/out/base-prompts/skills/openclaw/scripts/run-smoke.sh +0 -61
  224. package/out/base-prompts/skills/pdf/LICENSE.txt +0 -30
  225. package/out/base-prompts/skills/pdf/SKILL.md +0 -294
  226. package/out/base-prompts/skills/pdf/forms.md +0 -205
  227. package/out/base-prompts/skills/pdf/reference.md +0 -612
  228. package/out/base-prompts/skills/pdf/scripts/check_bounding_boxes.py +0 -70
  229. package/out/base-prompts/skills/pdf/scripts/check_bounding_boxes_test.py +0 -226
  230. package/out/base-prompts/skills/pdf/scripts/check_fillable_fields.py +0 -12
  231. package/out/base-prompts/skills/pdf/scripts/convert_pdf_to_images.py +0 -35
  232. package/out/base-prompts/skills/pdf/scripts/create_validation_image.py +0 -41
  233. package/out/base-prompts/skills/pdf/scripts/extract_form_field_info.py +0 -152
  234. package/out/base-prompts/skills/pdf/scripts/fill_fillable_fields.py +0 -114
  235. package/out/base-prompts/skills/pdf/scripts/fill_pdf_form_with_annotations.py +0 -108
  236. package/out/base-prompts/skills/pptx/LICENSE.txt +0 -30
  237. package/out/base-prompts/skills/pptx/SKILL.md +0 -484
  238. package/out/base-prompts/skills/pptx/html2pptx.md +0 -625
  239. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +0 -1499
  240. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +0 -146
  241. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +0 -1085
  242. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +0 -11
  243. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +0 -3081
  244. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +0 -23
  245. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +0 -185
  246. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +0 -287
  247. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +0 -1676
  248. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +0 -28
  249. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +0 -144
  250. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +0 -174
  251. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +0 -25
  252. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +0 -18
  253. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +0 -59
  254. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +0 -56
  255. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +0 -195
  256. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +0 -582
  257. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +0 -25
  258. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +0 -4439
  259. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +0 -570
  260. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +0 -509
  261. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +0 -12
  262. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +0 -108
  263. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +0 -96
  264. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +0 -3646
  265. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +0 -116
  266. package/out/base-prompts/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +0 -42
  267. package/out/base-prompts/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +0 -50
  268. package/out/base-prompts/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +0 -49
  269. package/out/base-prompts/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +0 -33
  270. package/out/base-prompts/skills/pptx/ooxml/schemas/mce/mc.xsd +0 -75
  271. package/out/base-prompts/skills/pptx/ooxml/schemas/microsoft/wml-2010.xsd +0 -560
  272. package/out/base-prompts/skills/pptx/ooxml/schemas/microsoft/wml-2012.xsd +0 -67
  273. package/out/base-prompts/skills/pptx/ooxml/schemas/microsoft/wml-2018.xsd +0 -14
  274. package/out/base-prompts/skills/pptx/ooxml/schemas/microsoft/wml-cex-2018.xsd +0 -20
  275. package/out/base-prompts/skills/pptx/ooxml/schemas/microsoft/wml-cid-2016.xsd +0 -13
  276. package/out/base-prompts/skills/pptx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +0 -4
  277. package/out/base-prompts/skills/pptx/ooxml/schemas/microsoft/wml-symex-2015.xsd +0 -8
  278. package/out/base-prompts/skills/pptx/ooxml/scripts/pack.py +0 -159
  279. package/out/base-prompts/skills/pptx/ooxml/scripts/unpack.py +0 -29
  280. package/out/base-prompts/skills/pptx/ooxml/scripts/validate.py +0 -69
  281. package/out/base-prompts/skills/pptx/ooxml/scripts/validation/__init__.py +0 -15
  282. package/out/base-prompts/skills/pptx/ooxml/scripts/validation/base.py +0 -951
  283. package/out/base-prompts/skills/pptx/ooxml/scripts/validation/docx.py +0 -274
  284. package/out/base-prompts/skills/pptx/ooxml/scripts/validation/pptx.py +0 -315
  285. package/out/base-prompts/skills/pptx/ooxml/scripts/validation/redlining.py +0 -279
  286. package/out/base-prompts/skills/pptx/ooxml.md +0 -427
  287. package/out/base-prompts/skills/pptx/scripts/html2pptx.js +0 -984
  288. package/out/base-prompts/skills/pptx/scripts/inventory.py +0 -1020
  289. package/out/base-prompts/skills/pptx/scripts/rearrange.py +0 -231
  290. package/out/base-prompts/skills/pptx/scripts/replace.py +0 -385
  291. package/out/base-prompts/skills/pptx/scripts/thumbnail.py +0 -450
  292. package/out/base-prompts/skills/prompt-lab/SKILL.md +0 -149
  293. package/out/base-prompts/skills/prompt-lab/scripts/query-analytics.sh +0 -2551
  294. package/out/base-prompts/skills/skill-creator/LICENSE.txt +0 -202
  295. package/out/base-prompts/skills/skill-creator/SKILL.md +0 -371
  296. package/out/base-prompts/skills/skill-creator/references/output-patterns.md +0 -82
  297. package/out/base-prompts/skills/skill-creator/references/workflows.md +0 -28
  298. package/out/base-prompts/skills/skill-creator/scripts/init_skill.py +0 -303
  299. package/out/base-prompts/skills/skill-creator/scripts/package_skill.py +0 -110
  300. package/out/base-prompts/skills/skill-creator/scripts/quick_validate.py +0 -95
  301. package/out/base-prompts/skills/skill-installer/SKILL.md +0 -251
  302. package/out/base-prompts/skills/skill-installer/references/store-api.md +0 -219
  303. package/out/base-prompts/skills/spotlight-dashboard/SKILL.md +0 -83
  304. package/out/base-prompts/skills/spotlight-insights/SKILL.md +0 -101
  305. package/out/base-prompts/skills/spotlight-optimize/SKILL.md +0 -93
  306. package/out/base-prompts/skills/spotlight-optimize/scripts/query-analytics.sh +0 -2551
  307. package/out/base-prompts/skills/spotlight-query/SKILL.md +0 -314
  308. package/out/base-prompts/skills/spotlight-query/references/otel-schema.md +0 -163
  309. package/out/base-prompts/skills/spotlight-query/scripts/query-analytics.sh +0 -2551
  310. package/out/base-prompts/skills/spotlight-query/scripts/query-analytics.test.sh +0 -744
  311. package/out/base-prompts/skills/spotlight-query/scripts/test-fixtures/analytics/sessions/sess-test-1.jsonl +0 -14
  312. package/out/base-prompts/skills/spotlight-query/scripts/test-fixtures/analytics/traces/.duckdb-index.json +0 -7
  313. package/out/base-prompts/skills/spotlight-query/scripts/test-fixtures/analytics/traces/sample.jsonl +0 -5
  314. package/out/base-prompts/skills/spotlight-report/SKILL.md +0 -86
  315. package/out/base-prompts/skills/spotlight-visualize/SKILL.md +0 -92
  316. package/out/base-prompts/skills/spotlight-visualize/scripts/query-analytics.sh +0 -2551
  317. package/out/base-prompts/skills/xlsx/LICENSE.txt +0 -30
  318. package/out/base-prompts/skills/xlsx/SKILL.md +0 -289
  319. package/out/base-prompts/skills/xlsx/recalc.py +0 -178
  320. package/out/branding.js +0 -49
  321. package/out/cli/commands/anywhere.js +0 -66
  322. package/out/cli/commands/ask.js +0 -246
  323. package/out/cli/commands/auth-broker.js +0 -24
  324. package/out/cli/commands/auth.js +0 -219
  325. package/out/cli/commands/chat.js +0 -357
  326. package/out/cli/commands/conformance.js +0 -249
  327. package/out/cli/commands/data-plane.js +0 -151
  328. package/out/cli/commands/deploy.js +0 -263
  329. package/out/cli/commands/gateway.js +0 -218
  330. package/out/cli/commands/idp.js +0 -85
  331. package/out/cli/commands/pack.js +0 -399
  332. package/out/cli/commands/probe-custom-engine.js +0 -82
  333. package/out/cli/commands/sandbox.js +0 -351
  334. package/out/cli/commands/serve.js +0 -1950
  335. package/out/cli/commands/store.js +0 -927
  336. package/out/cli/credential-context.js +0 -108
  337. package/out/cli/data-plane/broker.js +0 -78
  338. package/out/cli/data-plane/connector-host.js +0 -121
  339. package/out/cli/data-plane/egress.js +0 -189
  340. package/out/cli/data-plane/gateway.js +0 -218
  341. package/out/cli/data-plane/index.js +0 -153
  342. package/out/cli/data-plane/registry.js +0 -89
  343. package/out/cli/data-plane/remote.js +0 -106
  344. package/out/cli/data-plane/sidecar.js +0 -225
  345. package/out/cli/deploy/blueprints/registry.js +0 -84
  346. package/out/cli/deploy/layers/identity.js +0 -175
  347. package/out/cli/deploy-init.js +0 -3023
  348. package/out/cli/deps.js +0 -342
  349. package/out/cli/idp-init.js +0 -338
  350. package/out/cli/pack-install-ref.js +0 -15
  351. package/out/cli/pack-loader.js +0 -418
  352. package/out/cli/pack-runtime.js +0 -61
  353. package/out/cli/runtime.js +0 -450
  354. package/out/cli/serve-hardening.js +0 -776
  355. package/out/cli/state-sync.js +0 -424
  356. package/out/cli/utils.js +0 -231
  357. package/out/engines/base.js +0 -188
  358. package/out/engines/claude.js +0 -1254
  359. package/out/engines/codex.js +0 -862
  360. package/out/engines/custom.js +0 -680
  361. package/out/engines/customEngineIpc.js +0 -95
  362. package/out/engines/customEngineRunnerEmbed.js +0 -107
  363. package/out/engines/customRegistry.js +0 -274
  364. package/out/engines/embeddedCustomEngineRunner.generated.js +0 -9
  365. package/out/engines/engineApiKey.js +0 -138
  366. package/out/engines/install.js +0 -372
  367. package/out/engines/persistentEngineWorker.js +0 -320
  368. package/out/engines/publish.js +0 -341
  369. package/out/evidence/sessionShip.js +0 -643
  370. package/out/gateway/bridge.js +0 -843
  371. package/out/gateway/cli-agent-id.js +0 -36
  372. package/out/gateway/client.js +0 -336
  373. package/out/gateway/client.test.js +0 -395
  374. package/out/gateway/gateway-scope-errors.js +0 -14
  375. package/out/gateway/gatewayBackup.js +0 -76
  376. package/out/gateway/installSource.js +0 -68
  377. package/out/gateway/lifecycle.js +0 -3190
  378. package/out/gateway/openclaw-channel-routing.js +0 -317
  379. package/out/gateway/outboundHandles.js +0 -373
  380. package/out/gateway/outboundPaths.js +0 -75
  381. package/out/gateway/outboundSend.js +0 -254
  382. package/out/gateway/protocol.js +0 -48
  383. package/out/gateway/secretsPreflight.js +0 -90
  384. package/out/gateway/sessionRouting.js +0 -77
  385. package/out/headless/index.js +0 -546
  386. package/out/headless/sync.js +0 -473
  387. package/out/live-e2e/mcp-demo/server.mjs +0 -32
  388. package/out/live-probe/connector.mjs +0 -8
  389. package/out/live-probe/env-report.mjs +0 -8
  390. package/out/mcp.js +0 -654
  391. package/out/pack/caps.js +0 -271
  392. package/out/pack/governor.js +0 -326
  393. package/out/pack/lease-schema.js +0 -273
  394. package/out/pack/lease.js +0 -682
  395. package/out/pack/reconcile.js +0 -217
  396. package/out/pack/signature.js +0 -839
  397. package/out/permissions.js +0 -108
  398. package/out/permissions.mapping.yaml +0 -68
  399. package/out/registry/index.js +0 -332
  400. package/out/runner/host.js +0 -141
  401. package/out/runner/protocol.js +0 -128
  402. package/out/runner/remoteEngine.js +0 -166
  403. package/out/runtime/interfaces/config-provider.js +0 -32
  404. package/out/runtime/interfaces/edit-tracker.js +0 -24
  405. package/out/runtime/interfaces/index.js +0 -29
  406. package/out/runtime/interfaces/logger.js +0 -40
  407. package/out/runtime/interfaces/permission-handler.js +0 -66
  408. package/out/runtime/interfaces/session-store.js +0 -342
  409. package/out/runtime/vscode/vscode-session-store.js +0 -22
  410. package/out/sandbox/containerDriver.js +0 -572
  411. package/out/sandbox/processDriver.js +0 -318
  412. package/out/sandbox/sandboxRunner.js +0 -303
  413. package/out/sandbox/support.js +0 -301
  414. package/out/sandbox/types.js +0 -55
  415. package/out/scripts/analytics/fleet-local-adapter.js +0 -246
  416. package/out/scripts/analytics/live-fleet-4-collector.cjs +0 -315
  417. package/out/scripts/analytics/live-fleet-4-daemon.mjs +0 -134
  418. package/out/scripts/analytics/live-fleet-4-widget.cjs +0 -433
  419. package/out/scripts/gateway/Dockerfile.serve +0 -45
  420. package/out/scripts/gateway/docker-serve.sh +0 -248
  421. package/out/scripts/gateway/setup-gateway-server.ps1 +0 -953
  422. package/out/scripts/gateway/setup-gateway-server.sh +0 -935
  423. package/out/session.js +0 -272
  424. package/out/shared/agentEngines.js +0 -170
  425. package/out/shared/index.js +0 -109
  426. package/out/shared/models.js +0 -136
  427. package/out/shared/providers.js +0 -205
  428. package/out/spotlight/install.js +0 -345
  429. package/out/spotlight/publish.js +0 -544
  430. package/out/spotlight/yaml.js +0 -31
  431. package/out/store/index.js +0 -786
  432. package/out/store/shared.js +0 -241
  433. package/out/test/agentEnvFile.test.js +0 -97
  434. package/out/test/agentYaml.test.js +0 -373
  435. package/out/test/agentpack.test.js +0 -639
  436. package/out/test/analytics-lifecycle.test.js +0 -174
  437. package/out/test/analytics.test.js +0 -756
  438. package/out/test/auth-baseurl.test.js +0 -132
  439. package/out/test/auth-bootstrapApply.test.js +0 -123
  440. package/out/test/auth-broker-hardening.test.js +0 -227
  441. package/out/test/auth-broker.test.js +0 -541
  442. package/out/test/auth-callback.test.js +0 -62
  443. package/out/test/blueprint-registry.test.js +0 -105
  444. package/out/test/branding.test.js +0 -242
  445. package/out/test/caps-governor.test.js +0 -460
  446. package/out/test/cli-agent-id.test.js +0 -55
  447. package/out/test/codex-new-file-survival.test.js +0 -119
  448. package/out/test/configuration-scopes.test.js +0 -131
  449. package/out/test/credential-context.test.js +0 -160
  450. package/out/test/custom-env-layering.test.js +0 -151
  451. package/out/test/customEngineInstall.test.js +0 -100
  452. package/out/test/customRegistry.test.js +0 -122
  453. package/out/test/data-plane-engine-wiring.test.js +0 -282
  454. package/out/test/data-plane.test.js +0 -624
  455. package/out/test/deploy-init.test.js +0 -860
  456. package/out/test/deps-auto-install.test.js +0 -81
  457. package/out/test/egress-broker.test.js +0 -172
  458. package/out/test/engine-integration.test.js +0 -297
  459. package/out/test/enginePaths.test.js +0 -195
  460. package/out/test/enginePublish.test.js +0 -82
  461. package/out/test/fleetDisplayUtils.test.js +0 -100
  462. package/out/test/gateway-client.test.js +0 -409
  463. package/out/test/gateway-install-source.test.js +0 -111
  464. package/out/test/gateway-lifecycle.test.js +0 -608
  465. package/out/test/gateway-outbound.test.js +0 -538
  466. package/out/test/gateway-reset-mappings.test.js +0 -221
  467. package/out/test/gateway-route-index.test.js +0 -235
  468. package/out/test/gateway-secrets-preflight.test.js +0 -127
  469. package/out/test/gateway-session-routing.test.js +0 -65
  470. package/out/test/gateway-session-store.test.js +0 -216
  471. package/out/test/github.test.js +0 -232
  472. package/out/test/governor-hardening.test.js +0 -222
  473. package/out/test/headless-sync.test.js +0 -301
  474. package/out/test/helpers/manifest-fixtures.js +0 -27
  475. package/out/test/idp-init.test.js +0 -151
  476. package/out/test/lease-signature.test.js +0 -357
  477. package/out/test/lease-trust-root.test.js +0 -273
  478. package/out/test/lease-validation.test.js +0 -224
  479. package/out/test/lease.test.js +0 -114
  480. package/out/test/localFleetAdapter.test.js +0 -91
  481. package/out/test/mcp-obo.test.js +0 -107
  482. package/out/test/mcp.test.js +0 -389
  483. package/out/test/model-routing.test.js +0 -133
  484. package/out/test/openclaw-channel-routing.test.js +0 -191
  485. package/out/test/pack-admission.test.js +0 -216
  486. package/out/test/pack-digest-parity.test.js +0 -140
  487. package/out/test/pack-reconcile.test.js +0 -183
  488. package/out/test/pack-signature-artifact.test.js +0 -103
  489. package/out/test/pack-signature.test.js +0 -176
  490. package/out/test/pack-trust-root.test.js +0 -202
  491. package/out/test/pathSafety.test.js +0 -63
  492. package/out/test/permissions.test.js +0 -175
  493. package/out/test/persistent-engine-worker.test.js +0 -220
  494. package/out/test/refreshPolicy.test.js +0 -60
  495. package/out/test/registry.test.js +0 -351
  496. package/out/test/remote-trust.test.js +0 -242
  497. package/out/test/runner-protocol.test.js +0 -249
  498. package/out/test/runtime.test.js +0 -349
  499. package/out/test/sandbox-driver.test.js +0 -553
  500. package/out/test/sandbox-hardening.test.js +0 -406
  501. package/out/test/sandbox-runner.test.js +0 -343
  502. package/out/test/sandbox-scope.test.js +0 -449
  503. package/out/test/scheduledFleetStorage.test.js +0 -72
  504. package/out/test/serve-cron-acceptance.test.js +0 -370
  505. package/out/test/serve-gateway-turn.test.js +0 -389
  506. package/out/test/serve-hardening.test.js +0 -591
  507. package/out/test/serveClient.test.js +0 -209
  508. package/out/test/sessionJsonlFleet.test.js +0 -78
  509. package/out/test/sessionShip.test.js +0 -618
  510. package/out/test/shared.test.js +0 -173
  511. package/out/test/skills-mcp.test.js +0 -299
  512. package/out/test/spotlightPublish.test.js +0 -327
  513. package/out/test/spotlightYaml.test.js +0 -58
  514. package/out/test/state-sync-peer.test.js +0 -156
  515. package/out/test/store-install-safe.test.js +0 -69
  516. package/out/test/store.test.js +0 -331
  517. package/out/test/stores.test.js +0 -504
  518. package/out/test/sync-switch.test.js +0 -251
  519. package/out/test/teamViewDiscovery.test.js +0 -90
  520. package/out/test/tls-bypass.test.js +0 -90
  521. package/out/test/toolPath.test.js +0 -120
  522. package/out/test/utils.test.js +0 -308
  523. package/out/test/viewsConfigMerge.test.js +0 -180
  524. package/out/test/warrant.test.js +0 -138
  525. package/out/test/windows-command-line.test.js +0 -75
  526. package/out/utils/agentEnvFile.js +0 -131
  527. package/out/utils/binary.js +0 -175
  528. package/out/utils/index.js +0 -37
  529. package/out/utils/network.js +0 -74
  530. package/out/utils/paths.js +0 -116
  531. package/out/utils/pid.js +0 -180
  532. package/out/utils/resolveNodeBinary.js +0 -168
  533. package/out/utils/windowsCommandLine.js +0 -29
  534. package/out/utils.js +0 -968
@@ -1,681 +0,0 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) AgentHippo.ai. All rights reserved.
4
- *--------------------------------------------------------------------------------------------*/
5
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- var desc = Object.getOwnPropertyDescriptor(m, k);
8
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
- desc = { enumerable: true, get: function() { return m[k]; } };
10
- }
11
- Object.defineProperty(o, k2, desc);
12
- }) : (function(o, m, k, k2) {
13
- if (k2 === undefined) k2 = k;
14
- o[k2] = m[k];
15
- }));
16
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
- Object.defineProperty(o, "default", { enumerable: true, value: v });
18
- }) : function(o, v) {
19
- o["default"] = v;
20
- });
21
- var __importStar = (this && this.__importStar) || (function () {
22
- var ownKeys = function(o) {
23
- ownKeys = Object.getOwnPropertyNames || function (o) {
24
- var ar = [];
25
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
- return ar;
27
- };
28
- return ownKeys(o);
29
- };
30
- return function (mod) {
31
- if (mod && mod.__esModule) return mod;
32
- var result = {};
33
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
- __setModuleDefault(result, mod);
35
- return result;
36
- };
37
- })();
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.hasTrustedProxyProof = void 0;
40
- exports.isAllowedRedirectUri = isAllowedRedirectUri;
41
- exports.createAuthBrokerServer = createAuthBrokerServer;
42
- exports.startAuthBrokerServer = startAuthBrokerServer;
43
- const http = __importStar(require("http"));
44
- const crypto = __importStar(require("crypto"));
45
- const url_1 = require("url");
46
- const path = __importStar(require("path"));
47
- const config_js_1 = require("./config.js");
48
- const store_js_1 = require("./store.js");
49
- const pkce_js_1 = require("./pkce.js");
50
- const jwt_js_1 = require("./jwt.js");
51
- const types_js_1 = require("../auth/types.js");
52
- const callbackUriParse_js_1 = require("../auth/callbackUriParse.js");
53
- const serve_hardening_js_1 = require("../cli/serve-hardening.js");
54
- /**
55
- * Restrict `redirect_uri` to the shapes our own clients actually send — the CLI/IDE loopback
56
- * callback (127.0.0.1/localhost, any OS-assigned port, see loopbackAuthServer.ts) and the IDE
57
- * URI-scheme callback (any editor scheme, fixed authority+path, see callbackUri.ts). Without
58
- * this, `/oauth/authorize` would hand a real auth code to whatever `redirect_uri` a caller
59
- * supplies — an attacker can send a victim (who has an active SSO session) a link with their
60
- * own redirect_uri and code_challenge and steal the resulting code via their own server.
61
- */
62
- function isAllowedRedirectUri(redirectUri) {
63
- let target;
64
- try {
65
- target = new url_1.URL(redirectUri);
66
- }
67
- catch {
68
- return false;
69
- }
70
- // No embedded credentials, no query, no fragment. A permitted shape with a `?next=…` rider or a
71
- // `user:pass@` prefix is a different destination wearing an allowed hostname; the exchange binds
72
- // the code to this exact string, so anything that isn't the literal callback is refused here.
73
- if (target.username || target.password || target.search || target.hash) {
74
- return false;
75
- }
76
- if (target.protocol === 'http:') {
77
- // The loopback callback is the real IDE/CLI flow (loopbackAuthServer.ts binds an OS-assigned
78
- // port on 127.0.0.1), so the port cannot be pinned. The port is not what makes this safe:
79
- // the code is single-use, bound to THIS redirect_uri at issue time and verified against it at
80
- // /oauth/token, and PKCE binds it to a verifier only the initiating client holds. An attacker
81
- // who forges a loopback redirect_uri still receives a code they cannot exchange.
82
- // `localhost` is accepted for parity with the client, but nothing else resolves here.
83
- if (target.hostname !== '127.0.0.1' && target.hostname !== 'localhost') {
84
- return false;
85
- }
86
- if (target.pathname !== '/callback') {
87
- return false;
88
- }
89
- // A bare `http://127.0.0.1/callback` (port 80) is not something the loopback server ever
90
- // asks for — it needs a bindable ephemeral port — and port 80 is the one loopback port a
91
- // non-root process cannot claim, so refuse it rather than leave the shape open.
92
- return target.port !== '' && Number(target.port) > 1024;
93
- }
94
- if (target.protocol === 'https:') {
95
- // No https redirect target is a client of this broker: the IDE uses the editor URI scheme
96
- // and the CLI uses loopback. Allowing https here would make "redirect to my server" a
97
- // one-line manifest away.
98
- return false;
99
- }
100
- return (0, callbackUriParse_js_1.isAuthCallbackParts)(target.host, target.pathname);
101
- }
102
- /**
103
- * Does this request carry the trusted proxy's proof?
104
- *
105
- * `X-Auth-Request-Email` is only meaningful when it was set by our oauth2-proxy sidecar after a real
106
- * Google login. Nothing about the header says so, so the proxy also stamps a shared secret which is
107
- * checked constant-time, so a mismatched secret cannot be recovered byte by byte. The check lives in
108
- * serve-hardening (serve applies the same contract to its identity header via
109
- * AGENTHIPPO_IDENTITY_PROXY_SECRET); re-exported here for the broker's existing consumers.
110
- */
111
- var serve_hardening_js_2 = require("../cli/serve-hardening.js");
112
- Object.defineProperty(exports, "hasTrustedProxyProof", { enumerable: true, get: function () { return serve_hardening_js_2.hasTrustedProxyProof; } });
113
- function sendJson(res, status, body) {
114
- res.writeHead(status, { 'Content-Type': 'application/json' });
115
- res.end(JSON.stringify(body));
116
- }
117
- /** Mask the local-part of an email for logs: `n***@example.com` (domain kept for debugging). */
118
- function maskEmail(value) {
119
- const at = value.indexOf('@');
120
- if (at <= 0) {
121
- return value;
122
- }
123
- return `${value[0]}***@${value.slice(at + 1)}`;
124
- }
125
- /** Auth request bodies (PKCE codes, emails, form fields) are always tiny. */
126
- const MAX_BODY_BYTES = 64 * 1024;
127
- async function readBody(req) {
128
- const chunks = [];
129
- let size = 0;
130
- for await (const chunk of req) {
131
- const buf = typeof chunk === 'string' ? Buffer.from(chunk) : chunk;
132
- size += buf.length;
133
- if (size > MAX_BODY_BYTES) {
134
- const err = new Error('Request body too large');
135
- err.status = 413;
136
- throw err;
137
- }
138
- chunks.push(buf);
139
- }
140
- return Buffer.concat(chunks).toString('utf8');
141
- }
142
- function parseFormBody(raw) {
143
- const params = new URLSearchParams(raw);
144
- const out = {};
145
- for (const [key, value] of params.entries()) {
146
- out[key] = value;
147
- }
148
- return out;
149
- }
150
- /** Read a named cookie from the Cookie header. */
151
- function extractCookieToken(cookieHeader, name) {
152
- if (!cookieHeader?.trim()) {
153
- return undefined;
154
- }
155
- for (const part of cookieHeader.split(';')) {
156
- const eq = part.indexOf('=');
157
- if (eq <= 0) {
158
- continue;
159
- }
160
- const key = part.slice(0, eq).trim();
161
- if (key === name) {
162
- const val = part.slice(eq + 1).trim();
163
- if (val) {
164
- return val;
165
- }
166
- }
167
- }
168
- return undefined;
169
- }
170
- /**
171
- * Federated SSO (A′): validate a `return_to` redirect target for the browser-login endpoint.
172
- * The target host must live under the configured `cookieDomain` (e.g. `.agenthippo.ai`) so the
173
- * shared cookie we're about to set will actually be sent back to it. With no cookie domain
174
- * configured (dev), allow same-host / localhost.
175
- */
176
- function safeReturnTo(rawReturnTo, cookieDomain, fallback) {
177
- try {
178
- const target = new url_1.URL(rawReturnTo);
179
- if (target.protocol !== 'http:' && target.protocol !== 'https:') {
180
- return fallback;
181
- }
182
- if (cookieDomain) {
183
- const parent = cookieDomain.replace(/^\./, '').toLowerCase();
184
- if (target.hostname.toLowerCase() === parent || target.hostname.toLowerCase().endsWith('.' + parent)) {
185
- return target.toString();
186
- }
187
- }
188
- else if (target.hostname === '127.0.0.1' || target.hostname === 'localhost') {
189
- return target.toString();
190
- }
191
- }
192
- catch {
193
- // fall through
194
- }
195
- return fallback;
196
- }
197
- function createAuthBrokerServer(config) {
198
- const resolved = config ?? (0, config_js_1.loadAuthBrokerConfig)();
199
- // Fail-closed: a known-default secret makes JWT forgery trivial.
200
- if (!resolved.devMode && resolved.jwtSecret === config_js_1.DEFAULT_JWT_SECRET) {
201
- throw new Error('AGENTHIPPO_AUTH_JWT_SECRET must be set to a strong secret in production. ' +
202
- 'Generate one with: openssl rand -hex 32');
203
- }
204
- // Fail-closed: without a proxy proof, `X-Auth-Request-Email` is a self-asserted claim. Anything
205
- // that can reach this port could send `X-Auth-Request-Email: ceo@example.com` with a loopback
206
- // redirect_uri to /oauth/authorize and exchange the resulting code at the ungated /oauth/token —
207
- // a full account takeover with no credential. Same posture as the JWT/LiteLLM defaults above:
208
- // refuse to boot rather than run a broker whose identity input is unauthenticated.
209
- if (!resolved.devMode && !resolved.proxySecret && !resolved.trustProxyHeadersUnverified) {
210
- throw new Error('AGENTHIPPO_AUTH_PROXY_SECRET must be set in production. The broker trusts ' +
211
- 'X-Auth-Request-Email from the oauth2-proxy/Caddy forward_auth sidecar; without a shared ' +
212
- 'secret proving the header came from that sidecar, any caller that reaches this port can ' +
213
- 'mint a token for an arbitrary email.\n' +
214
- ' 1. Generate one: openssl rand -hex 32\n' +
215
- ` 2. Set it here: AGENTHIPPO_AUTH_PROXY_SECRET=<secret>\n` +
216
- ` 3. Have the proxy send it, e.g. in the Caddyfile:\n` +
217
- ` header_up ${config_js_1.AUTH_PROXY_SECRET_HEADER} {env.AGENTHIPPO_AUTH_PROXY_SECRET}\n` +
218
- 'If the broker is genuinely unreachable except through the proxy and you accept the risk, ' +
219
- 'set AGENTHIPPO_AUTH_TRUST_PROXY_UNVERIFIED=1.');
220
- }
221
- if (!resolved.devMode && !resolved.proxySecret && resolved.trustProxyHeadersUnverified) {
222
- console.warn('[auth-broker] WARNING: AGENTHIPPO_AUTH_TRUST_PROXY_UNVERIFIED=1 — X-Auth-Request-Email is ' +
223
- 'accepted without proof. Anything that can reach this port can mint a token for any email. ' +
224
- 'Set AGENTHIPPO_AUTH_PROXY_SECRET to close this.');
225
- }
226
- // Warn when no domain restriction is configured: any SSO-authenticated email can sign in.
227
- if (!resolved.devMode && resolved.allowedEmailDomains.length === 0) {
228
- console.warn('[auth-broker] Warning: AGENTHIPPO_AUTH_ALLOWED_DOMAINS is not set — ' +
229
- 'any upstream-SSO-authenticated email can receive a token. ' +
230
- 'Set it to restrict sign-in (e.g. "example.com").');
231
- }
232
- const persistPath = resolved.dataDir
233
- ? path.join(resolved.dataDir, 'auth-store.json')
234
- : undefined;
235
- const store = new store_js_1.AuthBrokerStore(resolved, persistPath);
236
- // Per-client-IP cap on the credential-issuing endpoints (authorize/token/dev-login) so a
237
- // direct caller can't brute-force or hammer them. /api/ide/me is deliberately exempt: Caddy
238
- // forward_auth calls it on every IDE request and it's already cheap + cached.
239
- const authLimiter = new serve_hardening_js_1.RateLimiter(resolved.rateLimitPerMin);
240
- /** Structured auth-event audit log; emails masked unless AGENTHIPPO_AUTH_LOG_PII=1. */
241
- const audit = (event, fields = {}) => {
242
- const parts = Object.entries(fields)
243
- .filter(([, v]) => v !== undefined && v !== '')
244
- .map(([k, v]) => {
245
- const masked = !resolved.logPii && typeof v === 'string' && v.includes('@') ? maskEmail(v) : v;
246
- return `${k}=${masked}`;
247
- })
248
- .join(' ');
249
- console.log(`[auth-broker] ${event}${parts ? ' ' + parts : ''}`);
250
- };
251
- // Short-lived positive cache for /api/ide/me (Caddy forward_auth calls it on every IDE
252
- // /v1/* request). Access tokens are short-lived JWTs with no server-side revocation, so
253
- // trusting a verified token for a few seconds is safe and avoids a verifyJwt+getUser
254
- // round-trip on every chat turn. Keyed by token hash; capped + pruned.
255
- const ME_CACHE_TTL_MS = 10_000;
256
- const ME_CACHE_MAX = 2048;
257
- const meCache = new Map();
258
- // Throttle the per-turn /me 401 audit so an expired-token burst doesn't spam the log.
259
- const ME_UNAUTHORIZED_LOG_INTERVAL_MS = 5_000;
260
- let lastMeUnauthorizedLogMs = 0;
261
- function resolveAuthedUser(req) {
262
- // Bearer (IDE) first; fall back to the federated `.agenthippo.ai` cookie (browser).
263
- const bearer = (0, jwt_js_1.extractBearerToken)(req.headers.authorization)
264
- || extractCookieToken(req.headers.cookie, resolved.cookieName);
265
- if (!bearer) {
266
- return undefined;
267
- }
268
- const key = crypto.createHash('sha256').update(bearer).digest('hex');
269
- const cached = meCache.get(key);
270
- if (cached) {
271
- if (cached.exp > Date.now()) {
272
- return cached.user;
273
- }
274
- meCache.delete(key);
275
- }
276
- const payload = (0, jwt_js_1.verifyJwt)(bearer, resolved.jwtSecret);
277
- if (!payload?.sub || !payload.email) {
278
- return undefined;
279
- }
280
- let user = store.getUser(String(payload.sub));
281
- // Federated trust (A′): a token signed with our shared AGENTHIPPO_AUTH_JWT_SECRET is
282
- // authoritative even when the issuing user record lives in the central IdP's store, not
283
- // this broker's local store (which is an empty ephemeral volume on distributed edge
284
- // services). The IdP vouches for sub/email/name; the HMAC signature is the proof. The
285
- // IdP's own broker still hits getUser for its locally-created users, so this fallback is
286
- // a no-op there.
287
- if (!user) {
288
- const teamIdFromToken = typeof payload.team_id === 'string' && payload.team_id ? payload.team_id : undefined;
289
- user = {
290
- id: String(payload.sub),
291
- email: String(payload.email),
292
- displayName: typeof payload.name === 'string' && payload.name ? payload.name : String(payload.email),
293
- teamId: teamIdFromToken ?? (resolved.teamConfigured ? resolved.team.id : undefined),
294
- };
295
- }
296
- if (payload.exp) {
297
- const exp = Math.min(payload.exp * 1000, Date.now() + ME_CACHE_TTL_MS);
298
- if (meCache.size >= ME_CACHE_MAX) {
299
- const now = Date.now();
300
- for (const [k, v] of meCache) {
301
- if (v.exp < now) {
302
- meCache.delete(k);
303
- }
304
- }
305
- if (meCache.size >= ME_CACHE_MAX) {
306
- meCache.clear();
307
- }
308
- }
309
- meCache.set(key, { user, exp });
310
- }
311
- return user;
312
- }
313
- /**
314
- * Read the SSO-asserted email, but only if the request proved it came from the trusted proxy.
315
- * Returns `undefined` when there is no email, and `null` when an email was present but the proof
316
- * was missing/wrong — those are different failures and the second one is worth auditing loudly.
317
- */
318
- const proxyAssertedEmail = (req) => {
319
- const email = (req.headers['x-auth-request-email'] || '').trim().toLowerCase();
320
- if (!email) {
321
- return undefined;
322
- }
323
- // devMode and the explicit unverified opt-in are the only ways past the proof.
324
- if (resolved.devMode || (!resolved.proxySecret && resolved.trustProxyHeadersUnverified)) {
325
- return email;
326
- }
327
- if (!(0, serve_hardening_js_1.hasTrustedProxyProof)(req.headers, resolved.proxySecret)) {
328
- return null;
329
- }
330
- return email;
331
- };
332
- const rejectForgedProxyHeader = (res, ip, pathname) => {
333
- audit('proxy_header.unverified', { ip, path: pathname });
334
- sendJson(res, 401, {
335
- error: 'unauthorized',
336
- error_description: `X-Auth-Request-Email was present without a valid ${config_js_1.AUTH_PROXY_SECRET_HEADER} header. ` +
337
- 'Only the trusted reverse proxy may assert an identity to this broker.',
338
- });
339
- };
340
- const server = http.createServer(async (req, res) => {
341
- try {
342
- const host = req.headers.host || `127.0.0.1:${resolved.port}`;
343
- const url = new url_1.URL(req.url || '/', `http://${host}`);
344
- const pathname = url.pathname;
345
- // Gate on the credential-issuing endpoints only (see authLimiter note above).
346
- const ip = (0, serve_hardening_js_1.clientIp)(req);
347
- const rateLimited = () => {
348
- if (authLimiter.tryConsume(ip)) {
349
- return false;
350
- }
351
- audit('rate_limited', { ip, path: pathname });
352
- res.writeHead(429, { 'Content-Type': 'application/json', 'Retry-After': String(authLimiter.retryAfterSeconds(ip)) });
353
- res.end(JSON.stringify({ error: 'rate_limited' }));
354
- return true;
355
- };
356
- if (req.method === 'GET' && (pathname === '/health' || pathname === '/api/ide/health')) {
357
- sendJson(res, 200, { status: 'ok', service: 'auth-broker' });
358
- return;
359
- }
360
- if (req.method === 'GET' && pathname === '/oauth/authorize') {
361
- if (rateLimited()) {
362
- return;
363
- }
364
- const clientId = url.searchParams.get('client_id') || '';
365
- const redirectUri = url.searchParams.get('redirect_uri') || '';
366
- const codeChallenge = url.searchParams.get('code_challenge') || '';
367
- const state = url.searchParams.get('state') || '';
368
- const loginHint = url.searchParams.get('login_hint') || url.searchParams.get('email') || '';
369
- if (clientId !== types_js_1.AUTH_CLIENT_ID || !redirectUri || !codeChallenge) {
370
- audit('authorize.invalid_request', { client_id: clientId });
371
- sendJson(res, 400, { error: 'invalid_request' });
372
- return;
373
- }
374
- if (!isAllowedRedirectUri(redirectUri)) {
375
- audit('authorize.invalid_redirect_uri', { client_id: clientId });
376
- sendJson(res, 400, { error: 'invalid_request', error_description: 'redirect_uri not allowed' });
377
- return;
378
- }
379
- // Dev mode with explicit login_hint: auto-authenticate (backward compat for tests).
380
- if (resolved.devMode && loginHint) {
381
- const user = store.upsertUser(loginHint);
382
- const code = store.createAuthCode({ userId: user.id, clientId, redirectUri, codeChallenge });
383
- audit('authorize.dev', { user: user.email });
384
- const redirect = new url_1.URL(redirectUri);
385
- redirect.searchParams.set('code', code);
386
- if (state) {
387
- redirect.searchParams.set('state', state);
388
- }
389
- res.writeHead(302, { Location: redirect.toString() });
390
- res.end();
391
- return;
392
- }
393
- // Caddy forward_auth (via oauth2-proxy) sets X-Auth-Request-Email after the user
394
- // logs in with Google. The authorize endpoint is gated behind forward_auth in the
395
- // Caddyfile so this header is always present when the request reaches the broker —
396
- // but a caller that reaches the broker DIRECTLY can set it too, which is why the
397
- // proxy also has to prove who it is.
398
- const userEmail = proxyAssertedEmail(req);
399
- if (userEmail === null) {
400
- rejectForgedProxyHeader(res, ip, pathname);
401
- return;
402
- }
403
- if (!userEmail) {
404
- sendJson(res, 401, { error: 'unauthorized', error_description: 'No authenticated user (missing X-Auth-Request-Email)' });
405
- return;
406
- }
407
- const user = store.upsertUser(userEmail);
408
- const code = store.createAuthCode({ userId: user.id, clientId, redirectUri, codeChallenge });
409
- audit('authorize.signin', { user: user.email });
410
- const redirect = new url_1.URL(redirectUri);
411
- redirect.searchParams.set('code', code);
412
- if (state) {
413
- redirect.searchParams.set('state', state);
414
- }
415
- res.writeHead(302, { Location: redirect.toString() });
416
- res.end();
417
- return;
418
- }
419
- if (req.method === 'GET' && pathname === '/oauth/browser-login') {
420
- if (rateLimited()) {
421
- return;
422
- }
423
- // Federated SSO (A′): the central IdP (auth.agenthippo.ai) stamps the shared
424
- // `.agenthippo.ai` cookie after Google SSO. Gated behind oauth2-proxy forward_auth
425
- // (same as /oauth/authorize) — X-Auth-Request-Email is only set once Google login
426
- // completes. Federated agent services never hit this path (they have no oauth2-proxy),
427
- // so it 401s there, which is correct.
428
- const userEmail = proxyAssertedEmail(req);
429
- if (userEmail === null) {
430
- rejectForgedProxyHeader(res, ip, pathname);
431
- return;
432
- }
433
- if (!userEmail) {
434
- sendJson(res, 401, { error: 'unauthorized', error_description: 'No authenticated user (missing X-Auth-Request-Email)' });
435
- return;
436
- }
437
- const user = store.upsertUser(userEmail);
438
- const tokens = store.issueTokens(user, types_js_1.AUTH_CLIENT_ID, 'openid profile email agenthippo:ide');
439
- audit('browser.login', { user: user.email });
440
- const secure = resolved.publicBaseUrl.startsWith('https');
441
- const cookieParts = [
442
- `${resolved.cookieName}=${tokens.accessToken}`,
443
- 'Path=/',
444
- 'HttpOnly',
445
- 'SameSite=Lax',
446
- ...(secure ? ['Secure'] : []),
447
- ...(resolved.cookieDomain ? [`Domain=${resolved.cookieDomain}`] : []),
448
- `Max-Age=${tokens.expiresIn}`,
449
- ];
450
- const returnTo = safeReturnTo(url.searchParams.get('return_to') || '', resolved.cookieDomain, resolved.publicBaseUrl || '/');
451
- res.writeHead(302, { 'Set-Cookie': cookieParts.join('; '), Location: returnTo });
452
- res.end();
453
- return;
454
- }
455
- if (req.method === 'POST' && pathname === '/oauth/dev/login') {
456
- if (rateLimited()) {
457
- return;
458
- }
459
- if (!resolved.devMode) {
460
- sendJson(res, 404, { error: 'not_found' });
461
- return;
462
- }
463
- const raw = await readBody(req);
464
- const body = raw.trim().startsWith('{')
465
- ? JSON.parse(raw)
466
- : parseFormBody(raw);
467
- const email = body.email?.trim();
468
- const codeChallenge = body.code_challenge?.trim();
469
- const redirectUri = body.redirect_uri?.trim();
470
- const clientId = body.client_id?.trim() || types_js_1.AUTH_CLIENT_ID;
471
- if (!email || !codeChallenge || !redirectUri) {
472
- sendJson(res, 400, { error: 'invalid_request' });
473
- return;
474
- }
475
- const user = store.upsertUser(email);
476
- const code = store.createAuthCode({
477
- userId: user.id,
478
- clientId,
479
- redirectUri,
480
- codeChallenge,
481
- });
482
- audit('dev.login', { user: user.email });
483
- sendJson(res, 200, { code });
484
- return;
485
- }
486
- if (req.method === 'POST' && pathname === '/oauth/token') {
487
- if (rateLimited()) {
488
- return;
489
- }
490
- const raw = await readBody(req);
491
- const body = parseFormBody(raw);
492
- const grantType = body.grant_type;
493
- const clientId = body.client_id || types_js_1.AUTH_CLIENT_ID;
494
- const scope = body.scope || 'openid profile email agenthippo:ide';
495
- if (grantType === 'authorization_code') {
496
- const code = body.code;
497
- const codeVerifier = body.code_verifier;
498
- const redirectUri = body.redirect_uri;
499
- if (!code || !codeVerifier || !redirectUri) {
500
- sendJson(res, 400, { error: 'invalid_request' });
501
- return;
502
- }
503
- const authCode = store.consumeAuthCode(code);
504
- if (!authCode || authCode.clientId !== clientId || authCode.redirectUri !== redirectUri) {
505
- sendJson(res, 400, { error: 'invalid_grant' });
506
- return;
507
- }
508
- if (!(0, pkce_js_1.verifyPkceChallenge)(codeVerifier, authCode.codeChallenge)) {
509
- sendJson(res, 400, { error: 'invalid_grant', error_description: 'PKCE verification failed' });
510
- return;
511
- }
512
- const user = store.getUser(authCode.userId);
513
- if (!user) {
514
- sendJson(res, 400, { error: 'invalid_grant' });
515
- return;
516
- }
517
- const tokens = store.issueTokens(user, clientId, scope);
518
- audit('token.signin', { user: user.email, client_id: clientId });
519
- sendJson(res, 200, {
520
- access_token: tokens.accessToken,
521
- refresh_token: tokens.refreshToken,
522
- token_type: 'Bearer',
523
- expires_in: tokens.expiresIn,
524
- scope,
525
- });
526
- return;
527
- }
528
- if (grantType === 'refresh_token') {
529
- const refreshToken = body.refresh_token;
530
- if (!refreshToken) {
531
- sendJson(res, 400, { error: 'invalid_request' });
532
- return;
533
- }
534
- const record = store.consumeRefreshToken(refreshToken);
535
- if (!record || record.clientId !== clientId) {
536
- audit('token.refresh.invalid_grant');
537
- sendJson(res, 400, { error: 'invalid_grant' });
538
- return;
539
- }
540
- const user = store.getUser(record.userId);
541
- if (!user) {
542
- sendJson(res, 400, { error: 'invalid_grant' });
543
- return;
544
- }
545
- const tokens = store.issueTokens(user, clientId, scope);
546
- audit('token.refresh', { user: user.email });
547
- sendJson(res, 200, {
548
- access_token: tokens.accessToken,
549
- refresh_token: tokens.refreshToken,
550
- token_type: 'Bearer',
551
- expires_in: tokens.expiresIn,
552
- scope,
553
- });
554
- return;
555
- }
556
- sendJson(res, 400, { error: 'unsupported_grant_type' });
557
- return;
558
- }
559
- if (req.method === 'POST' && pathname === '/oauth/introspect') {
560
- // RFC 7662: introspect must be protected. Require a valid bearer (any live JWT)
561
- // so an anonymous caller can't probe arbitrary tokens for user claims.
562
- if (!resolveAuthedUser(req)) {
563
- audit('introspect.unauthorized');
564
- sendJson(res, 401, { error: 'unauthorized' });
565
- return;
566
- }
567
- const raw = await readBody(req);
568
- const body = parseFormBody(raw);
569
- const token = body.token;
570
- if (!token) {
571
- sendJson(res, 400, { error: 'invalid_request' });
572
- return;
573
- }
574
- const payload = (0, jwt_js_1.verifyJwt)(token, resolved.jwtSecret);
575
- if (!payload?.sub) {
576
- sendJson(res, 200, { active: false });
577
- return;
578
- }
579
- sendJson(res, 200, {
580
- active: true,
581
- sub: payload.sub,
582
- email: payload.email,
583
- team_id: payload.team_id,
584
- scope: payload.scope,
585
- exp: payload.exp,
586
- });
587
- return;
588
- }
589
- const user = resolveAuthedUser(req);
590
- if (req.method === 'GET' && pathname === '/api/ide/me') {
591
- if (!user) {
592
- // /me is called per IDE turn via Caddy forward_auth; an expired-token burst
593
- // would spam this log, so throttle to one line per few seconds.
594
- const now = Date.now();
595
- if (now - lastMeUnauthorizedLogMs > ME_UNAUTHORIZED_LOG_INTERVAL_MS) {
596
- lastMeUnauthorizedLogMs = now;
597
- audit('me.unauthorized');
598
- }
599
- sendJson(res, 401, { error: 'unauthorized' });
600
- return;
601
- }
602
- // Set X-Agent-User so Caddy's forward_auth can copy the validated identity
603
- // into the upstream request without serve needing its own JWT validation.
604
- res.setHeader('X-Agent-User', user.email || user.id);
605
- // …and the ASSERTION alongside the identifier (PLAN/agent-identity.md §8.5 G1).
606
- // The identifier alone is all the edge forwarded until now, so an edge-registered
607
- // turn carried no `inboundToken`: `passthrough` failed closed on every tool call
608
- // and an RFC 8693 `exchange` provider had no subject_token. This is the same
609
- // token this request just verified — the browser (cookie) lane has no
610
- // Authorization header for the edge to relay, so it has to come from here.
611
- //
612
- // Not a new exposure: whatever presented this token — Bearer header or cookie —
613
- // is already on the request Caddy proxies to the agent. What changes is that the
614
- // connector sidecar can now reach it, which is the whole point.
615
- const presented = (0, jwt_js_1.extractBearerToken)(req.headers.authorization)
616
- || extractCookieToken(req.headers.cookie, resolved.cookieName);
617
- if (presented) {
618
- res.setHeader('X-Agent-User-Assertion', presented);
619
- }
620
- sendJson(res, 200, store.buildMe(user));
621
- return;
622
- }
623
- if (req.method === 'GET' && pathname === '/api/ide/bootstrap') {
624
- if (!user) {
625
- sendJson(res, 401, { error: 'unauthorized' });
626
- return;
627
- }
628
- sendJson(res, 200, store.buildBootstrap(user));
629
- return;
630
- }
631
- if (req.method === 'POST' && pathname === '/api/ide/signout') {
632
- if (user) {
633
- store.revokeRefreshTokensForUser(user.id);
634
- audit('signout', { user: user.email });
635
- }
636
- sendJson(res, 200, { ok: true });
637
- return;
638
- }
639
- sendJson(res, 404, { error: 'not_found' });
640
- }
641
- catch (err) {
642
- const status = err.status;
643
- if (status === 413) {
644
- sendJson(res, 413, { error: 'request_entity_too_large' });
645
- return;
646
- }
647
- if (status === 403) {
648
- audit('forbidden', { reason: 'email_domain' });
649
- sendJson(res, 403, { error: 'forbidden', error_description: 'email domain not allowed' });
650
- return;
651
- }
652
- // Log the real error internally; return a generic message so clients don't see
653
- // stack fragments / internal paths in the 500 body.
654
- console.error('[auth-broker] internal error', err);
655
- sendJson(res, 500, { error: 'server_error' });
656
- }
657
- });
658
- return {
659
- server,
660
- baseUrl: resolved.publicBaseUrl,
661
- store,
662
- config: resolved,
663
- close: () => new Promise((resolve, reject) => {
664
- server.close((err) => (err ? reject(err) : resolve()));
665
- }),
666
- };
667
- }
668
- async function startAuthBrokerServer(config) {
669
- const broker = createAuthBrokerServer(config);
670
- const bind = (0, config_js_1.resolveAuthBrokerBind)();
671
- if (bind.isPublic) {
672
- console.warn(`[auth-broker] WARNING: listening on ${bind.address}:${broker.config.port} — this ` +
673
- `token-issuing endpoint is reachable from off-host (AGENTHIPPO_AUTH_ALLOW_PUBLIC_BIND=1). ` +
674
- `Ensure only the reverse proxy can reach it and that AGENTHIPPO_AUTH_PROXY_SECRET is set.`);
675
- }
676
- await new Promise((resolve, reject) => {
677
- broker.server.listen(broker.config.port, bind.address, () => resolve());
678
- broker.server.once('error', reject);
679
- });
680
- return broker;
681
- }