@agenthippo-ai/agenthippo 0.1.0

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 (480) hide show
  1. package/LICENSE +21 -0
  2. package/bin/agenthippo.js +2 -0
  3. package/out/agentpack/github.js +547 -0
  4. package/out/agentpack/index.js +66 -0
  5. package/out/agentpack/install.js +297 -0
  6. package/out/agentpack/manager.js +441 -0
  7. package/out/agentpack/manifest.js +135 -0
  8. package/out/agentpack/paths.js +475 -0
  9. package/out/agentpack/publish.js +248 -0
  10. package/out/agentpack/stores.js +554 -0
  11. package/out/agentpack/types.js +5 -0
  12. package/out/analytics/dashboard/artifactManager.js +439 -0
  13. package/out/analytics/dashboard/fleetDisplayUtils.js +159 -0
  14. package/out/analytics/dashboard/fleetOrchestrator.js +142 -0
  15. package/out/analytics/dashboard/fleetRegistry.js +79 -0
  16. package/out/analytics/dashboard/fleetRowDefaults.js +87 -0
  17. package/out/analytics/dashboard/fleetScriptAdapter.js +146 -0
  18. package/out/analytics/dashboard/fleetStatusUtils.js +30 -0
  19. package/out/analytics/dashboard/fleetTitleUtils.js +68 -0
  20. package/out/analytics/dashboard/fleetTypes.js +29 -0
  21. package/out/analytics/dashboard/index.js +17 -0
  22. package/out/analytics/dashboard/indexingService.js +422 -0
  23. package/out/analytics/dashboard/localFleetAdapter.js +222 -0
  24. package/out/analytics/dashboard/performanceMonitor.js +76 -0
  25. package/out/analytics/dashboard/processManager.js +209 -0
  26. package/out/analytics/dashboard/provider.js +3885 -0
  27. package/out/analytics/dashboard/queryRunner.js +994 -0
  28. package/out/analytics/dashboard/refreshPolicy.js +16 -0
  29. package/out/analytics/dashboard/scheduledFleetFingerprint.js +22 -0
  30. package/out/analytics/dashboard/scheduledFleetStorage.js +241 -0
  31. package/out/analytics/dashboard/scheduledFleetUtils.js +22 -0
  32. package/out/analytics/dashboard/sessionEventFleetStats.js +118 -0
  33. package/out/analytics/dashboard/sessionJsonlFleet.js +204 -0
  34. package/out/analytics/dashboard/teamViewDiscovery.js +106 -0
  35. package/out/analytics/dashboard/viewsConfigMerge.js +221 -0
  36. package/out/analytics/dashboard/webview/analytics-panel.html +155 -0
  37. package/out/analytics/dashboard/webview/codicon.ttf +0 -0
  38. package/out/analytics/dashboard/webview/index.html +78 -0
  39. package/out/analytics/dashboard/webview/panel.js +2295 -0
  40. package/out/analytics/dashboard/webview/runtime-bridge.js +82 -0
  41. package/out/analytics/dashboard/webview/styles.css +1009 -0
  42. package/out/analytics/lifecycle.js +43 -0
  43. package/out/analytics/service.js +1279 -0
  44. package/out/analytics/sessionEvents.js +231 -0
  45. package/out/auth/bootstrapApply.js +72 -0
  46. package/out/auth/brokerClient.js +126 -0
  47. package/out/auth/callbackUri.js +59 -0
  48. package/out/auth/callbackUriParse.js +59 -0
  49. package/out/auth/githubStoreGate.js +70 -0
  50. package/out/auth/loopbackAuthServer.js +165 -0
  51. package/out/auth/pkce.js +9 -0
  52. package/out/auth/provider.js +239 -0
  53. package/out/auth/sessionStore.js +193 -0
  54. package/out/auth/signInFlow.js +182 -0
  55. package/out/auth/types.js +12 -0
  56. package/out/auth-broker/config.js +62 -0
  57. package/out/auth-broker/jwt.js +105 -0
  58. package/out/auth-broker/pkce.js +57 -0
  59. package/out/auth-broker/server.js +539 -0
  60. package/out/auth-broker/store.js +273 -0
  61. package/out/base-prompts/gateway/openclaw-starter.json5 +144 -0
  62. package/out/base-prompts/gateway/slack-socket-mode-minimal.manifest.json +44 -0
  63. package/out/base-prompts/mcp-servers/.mcp.json +13 -0
  64. package/out/base-prompts/mcp-servers/langfuse-analytics/README.md +142 -0
  65. package/out/base-prompts/mcp-servers/langfuse-analytics/mcp.json +13 -0
  66. package/out/base-prompts/mcp-servers/langfuse-analytics/package-lock.json +1192 -0
  67. package/out/base-prompts/mcp-servers/langfuse-analytics/package.json +23 -0
  68. package/out/base-prompts/mcp-servers/langfuse-analytics/scripts/run-with-env.sh +12 -0
  69. package/out/base-prompts/mcp-servers/langfuse-analytics/scripts/sdk-test.js +102 -0
  70. package/out/base-prompts/mcp-servers/langfuse-analytics/scripts/simple-test.js +137 -0
  71. package/out/base-prompts/mcp-servers/langfuse-analytics/scripts/test-client.js +118 -0
  72. package/out/base-prompts/mcp-servers/langfuse-analytics/scripts/test-server.js +209 -0
  73. package/out/base-prompts/mcp-servers/langfuse-analytics/src/client.ts +431 -0
  74. package/out/base-prompts/mcp-servers/langfuse-analytics/src/index.ts +270 -0
  75. package/out/base-prompts/mcp-servers/langfuse-analytics/tsconfig.json +18 -0
  76. package/out/base-prompts/rules/AGENTS.md +204 -0
  77. package/out/base-prompts/skills/agent-browser/SKILL.md +102 -0
  78. package/out/base-prompts/skills/agent-builder/SKILL.md +73 -0
  79. package/out/base-prompts/skills/agent-builder/references/agent-pack.md +63 -0
  80. package/out/base-prompts/skills/agent-builder/references/crewai.md +66 -0
  81. package/out/base-prompts/skills/agent-builder/references/langchain.md +60 -0
  82. package/out/base-prompts/skills/agent-builder/references/raw-sdk.md +73 -0
  83. package/out/base-prompts/skills/agent-engine-creator/SKILL.md +586 -0
  84. package/out/base-prompts/skills/agent-engine-installer/SKILL.md +106 -0
  85. package/out/base-prompts/skills/agent-engine-installer/scripts/install-engine.mjs +259 -0
  86. package/out/base-prompts/skills/agent-engine-installer/scripts/install-engine.ps1 +189 -0
  87. package/out/base-prompts/skills/agenthippo-cli/SKILL.md +69 -0
  88. package/out/base-prompts/skills/agenthippo-cli/scripts/install.sh +63 -0
  89. package/out/base-prompts/skills/agentpack-creator/SKILL.md +375 -0
  90. package/out/base-prompts/skills/agentpack-creator/references/agent-templates.md +261 -0
  91. package/out/base-prompts/skills/agentpack-creator/references/agents-md-guide.md +195 -0
  92. package/out/base-prompts/skills/agentpack-creator/scripts/init_pack.py +391 -0
  93. package/out/base-prompts/skills/agentpack-creator/scripts/init_pack_test.py +294 -0
  94. package/out/base-prompts/skills/agentpack-testbench/SKILL.md +135 -0
  95. package/out/base-prompts/skills/algorithmic-art/LICENSE.txt +202 -0
  96. package/out/base-prompts/skills/algorithmic-art/SKILL.md +405 -0
  97. package/out/base-prompts/skills/algorithmic-art/templates/generator_template.js +223 -0
  98. package/out/base-prompts/skills/algorithmic-art/templates/viewer.html +599 -0
  99. package/out/base-prompts/skills/debug-agent/SKILL.md +83 -0
  100. package/out/base-prompts/skills/desktop-automation/SKILL.md +166 -0
  101. package/out/base-prompts/skills/desktop-automation/references/agenthippo-ui-recipes.md +441 -0
  102. package/out/base-prompts/skills/desktop-automation/scripts/windows-desktop-uia.psm1 +280 -0
  103. package/out/base-prompts/skills/docx/LICENSE.txt +30 -0
  104. package/out/base-prompts/skills/docx/SKILL.md +197 -0
  105. package/out/base-prompts/skills/docx/docx-js.md +350 -0
  106. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  107. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  108. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  109. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  110. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  111. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  112. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  113. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  114. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  115. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  116. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  117. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  118. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  119. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  120. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  121. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  122. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  123. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  124. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  125. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  126. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  127. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  128. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  129. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  130. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  131. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  132. package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  133. package/out/base-prompts/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
  134. package/out/base-prompts/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
  135. package/out/base-prompts/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
  136. package/out/base-prompts/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
  137. package/out/base-prompts/skills/docx/ooxml/schemas/mce/mc.xsd +75 -0
  138. package/out/base-prompts/skills/docx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
  139. package/out/base-prompts/skills/docx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
  140. package/out/base-prompts/skills/docx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
  141. package/out/base-prompts/skills/docx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
  142. package/out/base-prompts/skills/docx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
  143. package/out/base-prompts/skills/docx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  144. package/out/base-prompts/skills/docx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
  145. package/out/base-prompts/skills/docx/ooxml/scripts/pack.py +159 -0
  146. package/out/base-prompts/skills/docx/ooxml/scripts/unpack.py +29 -0
  147. package/out/base-prompts/skills/docx/ooxml/scripts/validate.py +69 -0
  148. package/out/base-prompts/skills/docx/ooxml/scripts/validation/__init__.py +15 -0
  149. package/out/base-prompts/skills/docx/ooxml/scripts/validation/base.py +951 -0
  150. package/out/base-prompts/skills/docx/ooxml/scripts/validation/docx.py +274 -0
  151. package/out/base-prompts/skills/docx/ooxml/scripts/validation/pptx.py +315 -0
  152. package/out/base-prompts/skills/docx/ooxml/scripts/validation/redlining.py +279 -0
  153. package/out/base-prompts/skills/docx/ooxml.md +610 -0
  154. package/out/base-prompts/skills/docx/scripts/__init__.py +1 -0
  155. package/out/base-prompts/skills/docx/scripts/document.py +1276 -0
  156. package/out/base-prompts/skills/docx/scripts/templates/comments.xml +3 -0
  157. package/out/base-prompts/skills/docx/scripts/templates/commentsExtended.xml +3 -0
  158. package/out/base-prompts/skills/docx/scripts/templates/commentsExtensible.xml +3 -0
  159. package/out/base-prompts/skills/docx/scripts/templates/commentsIds.xml +3 -0
  160. package/out/base-prompts/skills/docx/scripts/templates/people.xml +3 -0
  161. package/out/base-prompts/skills/docx/scripts/utilities.py +374 -0
  162. package/out/base-prompts/skills/gateway-outbound/SKILL.md +136 -0
  163. package/out/base-prompts/skills/mcp-builder/LICENSE.txt +202 -0
  164. package/out/base-prompts/skills/mcp-builder/SKILL.md +328 -0
  165. package/out/base-prompts/skills/mcp-builder/reference/evaluation.md +602 -0
  166. package/out/base-prompts/skills/mcp-builder/reference/mcp_best_practices.md +249 -0
  167. package/out/base-prompts/skills/mcp-builder/reference/node_mcp_server.md +970 -0
  168. package/out/base-prompts/skills/mcp-builder/reference/python_mcp_server.md +719 -0
  169. package/out/base-prompts/skills/mcp-builder/scripts/connections.py +151 -0
  170. package/out/base-prompts/skills/mcp-builder/scripts/evaluation.py +373 -0
  171. package/out/base-prompts/skills/mcp-builder/scripts/example_evaluation.xml +22 -0
  172. package/out/base-prompts/skills/mcp-builder/scripts/requirements.txt +2 -0
  173. package/out/base-prompts/skills/openclaw/SKILL.md +406 -0
  174. package/out/base-prompts/skills/openclaw/scripts/run-smoke.sh +61 -0
  175. package/out/base-prompts/skills/pdf/LICENSE.txt +30 -0
  176. package/out/base-prompts/skills/pdf/SKILL.md +294 -0
  177. package/out/base-prompts/skills/pdf/forms.md +205 -0
  178. package/out/base-prompts/skills/pdf/reference.md +612 -0
  179. package/out/base-prompts/skills/pdf/scripts/check_bounding_boxes.py +70 -0
  180. package/out/base-prompts/skills/pdf/scripts/check_bounding_boxes_test.py +226 -0
  181. package/out/base-prompts/skills/pdf/scripts/check_fillable_fields.py +12 -0
  182. package/out/base-prompts/skills/pdf/scripts/convert_pdf_to_images.py +35 -0
  183. package/out/base-prompts/skills/pdf/scripts/create_validation_image.py +41 -0
  184. package/out/base-prompts/skills/pdf/scripts/extract_form_field_info.py +152 -0
  185. package/out/base-prompts/skills/pdf/scripts/fill_fillable_fields.py +114 -0
  186. package/out/base-prompts/skills/pdf/scripts/fill_pdf_form_with_annotations.py +108 -0
  187. package/out/base-prompts/skills/pptx/LICENSE.txt +30 -0
  188. package/out/base-prompts/skills/pptx/SKILL.md +484 -0
  189. package/out/base-prompts/skills/pptx/html2pptx.md +625 -0
  190. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  191. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  192. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  193. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  194. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  195. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  196. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  197. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  198. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  199. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  200. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  201. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  202. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  203. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  204. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  205. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  206. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  207. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  208. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  209. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  210. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  211. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  212. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  213. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  214. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  215. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  216. package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  217. package/out/base-prompts/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
  218. package/out/base-prompts/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
  219. package/out/base-prompts/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
  220. package/out/base-prompts/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
  221. package/out/base-prompts/skills/pptx/ooxml/schemas/mce/mc.xsd +75 -0
  222. package/out/base-prompts/skills/pptx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
  223. package/out/base-prompts/skills/pptx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
  224. package/out/base-prompts/skills/pptx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
  225. package/out/base-prompts/skills/pptx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
  226. package/out/base-prompts/skills/pptx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
  227. package/out/base-prompts/skills/pptx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  228. package/out/base-prompts/skills/pptx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
  229. package/out/base-prompts/skills/pptx/ooxml/scripts/pack.py +159 -0
  230. package/out/base-prompts/skills/pptx/ooxml/scripts/unpack.py +29 -0
  231. package/out/base-prompts/skills/pptx/ooxml/scripts/validate.py +69 -0
  232. package/out/base-prompts/skills/pptx/ooxml/scripts/validation/__init__.py +15 -0
  233. package/out/base-prompts/skills/pptx/ooxml/scripts/validation/base.py +951 -0
  234. package/out/base-prompts/skills/pptx/ooxml/scripts/validation/docx.py +274 -0
  235. package/out/base-prompts/skills/pptx/ooxml/scripts/validation/pptx.py +315 -0
  236. package/out/base-prompts/skills/pptx/ooxml/scripts/validation/redlining.py +279 -0
  237. package/out/base-prompts/skills/pptx/ooxml.md +427 -0
  238. package/out/base-prompts/skills/pptx/scripts/html2pptx.js +984 -0
  239. package/out/base-prompts/skills/pptx/scripts/inventory.py +1020 -0
  240. package/out/base-prompts/skills/pptx/scripts/rearrange.py +231 -0
  241. package/out/base-prompts/skills/pptx/scripts/replace.py +385 -0
  242. package/out/base-prompts/skills/pptx/scripts/thumbnail.py +450 -0
  243. package/out/base-prompts/skills/prompt-lab/SKILL.md +149 -0
  244. package/out/base-prompts/skills/prompt-lab/scripts/query-analytics.sh +2551 -0
  245. package/out/base-prompts/skills/skill-creator/LICENSE.txt +202 -0
  246. package/out/base-prompts/skills/skill-creator/SKILL.md +371 -0
  247. package/out/base-prompts/skills/skill-creator/references/output-patterns.md +82 -0
  248. package/out/base-prompts/skills/skill-creator/references/workflows.md +28 -0
  249. package/out/base-prompts/skills/skill-creator/scripts/init_skill.py +303 -0
  250. package/out/base-prompts/skills/skill-creator/scripts/package_skill.py +110 -0
  251. package/out/base-prompts/skills/skill-creator/scripts/quick_validate.py +95 -0
  252. package/out/base-prompts/skills/skill-installer/SKILL.md +251 -0
  253. package/out/base-prompts/skills/skill-installer/references/store-api.md +219 -0
  254. package/out/base-prompts/skills/spotlight-dashboard/SKILL.md +83 -0
  255. package/out/base-prompts/skills/spotlight-insights/SKILL.md +101 -0
  256. package/out/base-prompts/skills/spotlight-optimize/SKILL.md +93 -0
  257. package/out/base-prompts/skills/spotlight-optimize/scripts/query-analytics.sh +2551 -0
  258. package/out/base-prompts/skills/spotlight-query/SKILL.md +314 -0
  259. package/out/base-prompts/skills/spotlight-query/references/otel-schema.md +163 -0
  260. package/out/base-prompts/skills/spotlight-query/scripts/query-analytics.sh +2551 -0
  261. package/out/base-prompts/skills/spotlight-query/scripts/query-analytics.test.sh +744 -0
  262. package/out/base-prompts/skills/spotlight-query/scripts/test-fixtures/analytics/sessions/sess-test-1.jsonl +14 -0
  263. package/out/base-prompts/skills/spotlight-query/scripts/test-fixtures/analytics/traces/.duckdb-index.json +7 -0
  264. package/out/base-prompts/skills/spotlight-query/scripts/test-fixtures/analytics/traces/sample.jsonl +5 -0
  265. package/out/base-prompts/skills/spotlight-report/SKILL.md +86 -0
  266. package/out/base-prompts/skills/spotlight-visualize/SKILL.md +92 -0
  267. package/out/base-prompts/skills/spotlight-visualize/scripts/query-analytics.sh +2551 -0
  268. package/out/base-prompts/skills/xlsx/LICENSE.txt +30 -0
  269. package/out/base-prompts/skills/xlsx/SKILL.md +289 -0
  270. package/out/base-prompts/skills/xlsx/recalc.py +178 -0
  271. package/out/branding.js +23 -0
  272. package/out/cli/commands/anywhere.js +66 -0
  273. package/out/cli/commands/ask.js +243 -0
  274. package/out/cli/commands/auth-broker.js +24 -0
  275. package/out/cli/commands/auth.js +219 -0
  276. package/out/cli/commands/chat.js +354 -0
  277. package/out/cli/commands/deploy.js +223 -0
  278. package/out/cli/commands/gateway.js +160 -0
  279. package/out/cli/commands/pack.js +220 -0
  280. package/out/cli/commands/probe-custom-engine.js +82 -0
  281. package/out/cli/commands/serve.js +583 -0
  282. package/out/cli/commands/store.js +919 -0
  283. package/out/cli/credential-context.js +113 -0
  284. package/out/cli/deploy-init.js +2087 -0
  285. package/out/cli/deps.js +238 -0
  286. package/out/cli/index.js +390 -0
  287. package/out/cli/pack-loader.js +376 -0
  288. package/out/cli/run-custom-engine-runner.js +318 -0
  289. package/out/cli/runtime.js +409 -0
  290. package/out/cli/serve-hardening.js +325 -0
  291. package/out/cli/state-sync.js +135 -0
  292. package/out/cli/utils.js +220 -0
  293. package/out/cli/vscode-shim.js +86 -0
  294. package/out/engines/base.js +159 -0
  295. package/out/engines/claude.js +1215 -0
  296. package/out/engines/codex.js +759 -0
  297. package/out/engines/custom.js +632 -0
  298. package/out/engines/customEngineIpc.js +95 -0
  299. package/out/engines/customEngineRunnerEmbed.js +107 -0
  300. package/out/engines/customRegistry.js +274 -0
  301. package/out/engines/embeddedCustomEngineRunner.generated.js +9 -0
  302. package/out/engines/engineApiKey.js +138 -0
  303. package/out/engines/factory.js +45 -0
  304. package/out/engines/install.js +372 -0
  305. package/out/engines/persistentEngineWorker.js +320 -0
  306. package/out/engines/publish.js +341 -0
  307. package/out/engines/types.js +17 -0
  308. package/out/examples/run-headless-repl.js +291 -0
  309. package/out/examples/run-headless.js +187 -0
  310. package/out/extension.js +4472 -0
  311. package/out/gateway/bridge.js +805 -0
  312. package/out/gateway/cli-agent-id.js +36 -0
  313. package/out/gateway/client.js +303 -0
  314. package/out/gateway/client.test.js +395 -0
  315. package/out/gateway/gateway-scope-errors.js +14 -0
  316. package/out/gateway/gatewayBackup.js +76 -0
  317. package/out/gateway/gatewayRouteIndex.js +371 -0
  318. package/out/gateway/gatewaySessionStore.js +243 -0
  319. package/out/gateway/index.js +31 -0
  320. package/out/gateway/lifecycle.js +3056 -0
  321. package/out/gateway/openclaw-channel-routing.js +317 -0
  322. package/out/gateway/outboundHandles.js +373 -0
  323. package/out/gateway/outboundPaths.js +72 -0
  324. package/out/gateway/outboundSend.js +254 -0
  325. package/out/gateway/protocol.js +48 -0
  326. package/out/gateway/resetMappings.js +52 -0
  327. package/out/gateway/service.js +1244 -0
  328. package/out/gateway/sessionRouting.js +77 -0
  329. package/out/headless/index.js +505 -0
  330. package/out/headless/sync.js +473 -0
  331. package/out/mcp/publish.js +143 -0
  332. package/out/mcp.js +597 -0
  333. package/out/permissions.js +108 -0
  334. package/out/permissions.mapping.yaml +68 -0
  335. package/out/registry/index.js +332 -0
  336. package/out/remote/handleRemoteChat.js +122 -0
  337. package/out/remote/remotePackStatusBar.js +103 -0
  338. package/out/remote/serveClient.js +216 -0
  339. package/out/remoteSkills.js +191 -0
  340. package/out/runtime/index.js +32 -0
  341. package/out/runtime/interfaces/config-provider.js +32 -0
  342. package/out/runtime/interfaces/edit-tracker.js +22 -0
  343. package/out/runtime/interfaces/index.js +29 -0
  344. package/out/runtime/interfaces/logger.js +40 -0
  345. package/out/runtime/interfaces/permission-handler.js +66 -0
  346. package/out/runtime/interfaces/session-store.js +342 -0
  347. package/out/runtime/vscode/index.js +20 -0
  348. package/out/runtime/vscode/vscode-config-provider.js +77 -0
  349. package/out/runtime/vscode/vscode-edit-tracker.js +120 -0
  350. package/out/runtime/vscode/vscode-logger.js +30 -0
  351. package/out/runtime/vscode/vscode-permission-handler.js +72 -0
  352. package/out/runtime/vscode/vscode-session-store.js +22 -0
  353. package/out/scripts/agentide-litellm.ps1 +501 -0
  354. package/out/scripts/agentide-litellm.sh +700 -0
  355. package/out/scripts/agentide_litellm_hooks_v1.py +604 -0
  356. package/out/scripts/analytics/agent-fleet-widget.js +954 -0
  357. package/out/scripts/analytics/agentide-litellm-otel.config.yaml +160 -0
  358. package/out/scripts/analytics/default-seed-scripts.json +12 -0
  359. package/out/scripts/analytics/duckdbLocator.js +29 -0
  360. package/out/scripts/analytics/fleet-local-adapter.js +246 -0
  361. package/out/scripts/analytics/fleet-workflow.sh +263 -0
  362. package/out/scripts/analytics/generate-default-charts.py +685 -0
  363. package/out/scripts/analytics/hotspot-analysis-widget.js +909 -0
  364. package/out/scripts/analytics/index-traces.py +1394 -0
  365. package/out/scripts/analytics/install-analytics.sh +286 -0
  366. package/out/scripts/analytics/live-fleet-4-collector.cjs +315 -0
  367. package/out/scripts/analytics/live-fleet-4-daemon.mjs +134 -0
  368. package/out/scripts/analytics/live-fleet-4-widget.cjs +433 -0
  369. package/out/scripts/analytics/otel-collector.yaml +55 -0
  370. package/out/scripts/analytics/query-analytics.ps1 +396 -0
  371. package/out/scripts/analytics/query-analytics.sh +2551 -0
  372. package/out/scripts/analytics/session-comparison-widget.js +1468 -0
  373. package/out/scripts/analytics/session-timeline-widget.js +2137 -0
  374. package/out/scripts/analytics/setup-analytics.ps1 +432 -0
  375. package/out/scripts/analytics/setup-analytics.sh +854 -0
  376. package/out/scripts/analytics/start-analytics.ps1 +169 -0
  377. package/out/scripts/analytics/start-analytics.sh +323 -0
  378. package/out/scripts/analytics/token-cost-flamegraph-widget.js +954 -0
  379. package/out/scripts/analytics/token-cost-trend-widget.js +1062 -0
  380. package/out/scripts/analytics/workflows-collector.cjs +315 -0
  381. package/out/scripts/analytics/workflows-daemon.mjs +186 -0
  382. package/out/scripts/analytics/workflows-widget.cjs +433 -0
  383. package/out/scripts/analytics/wow-model-widget.js +191 -0
  384. package/out/scripts/gateway/Dockerfile.serve +45 -0
  385. package/out/scripts/gateway/docker-serve.sh +248 -0
  386. package/out/scripts/gateway/setup-gateway-server.ps1 +953 -0
  387. package/out/scripts/gateway/setup-gateway-server.sh +935 -0
  388. package/out/scripts/gateway/setup-gateway.ps1 +1813 -0
  389. package/out/scripts/gateway/setup-gateway.sh +1541 -0
  390. package/out/scripts/setup-cli.ps1 +86 -0
  391. package/out/scripts/setup-cli.sh +117 -0
  392. package/out/scripts/tools-manifest.json +83 -0
  393. package/out/scripts/vendor-tools.mjs +234 -0
  394. package/out/session.js +272 -0
  395. package/out/shared/agentEngines.js +170 -0
  396. package/out/shared/index.js +109 -0
  397. package/out/shared/models.js +235 -0
  398. package/out/shared/providers.js +202 -0
  399. package/out/skills/publish.js +178 -0
  400. package/out/spotlight/install.js +339 -0
  401. package/out/spotlight/publish.js +544 -0
  402. package/out/spotlight/yaml.js +31 -0
  403. package/out/store/github/setup.js +235 -0
  404. package/out/store/github/templates/build-index.ts +339 -0
  405. package/out/store/github/templates/build-index.yml +97 -0
  406. package/out/store/github/templates/package.json +11 -0
  407. package/out/store/index.js +755 -0
  408. package/out/store/oramaIndex.js +884 -0
  409. package/out/store/shared.js +241 -0
  410. package/out/sync.js +1827 -0
  411. package/out/terminalLogger.js +358 -0
  412. package/out/test/agentEnvFile.test.js +97 -0
  413. package/out/test/agentYaml.test.js +373 -0
  414. package/out/test/agentpack.test.js +639 -0
  415. package/out/test/analytics-lifecycle.test.js +174 -0
  416. package/out/test/analytics.test.js +524 -0
  417. package/out/test/auth-bootstrapApply.test.js +102 -0
  418. package/out/test/auth-broker.test.js +434 -0
  419. package/out/test/auth-callback.test.js +62 -0
  420. package/out/test/branding.test.js +229 -0
  421. package/out/test/cli-agent-id.test.js +55 -0
  422. package/out/test/credential-context.test.js +105 -0
  423. package/out/test/customEngineInstall.test.js +100 -0
  424. package/out/test/customRegistry.test.js +122 -0
  425. package/out/test/deploy-init.test.js +532 -0
  426. package/out/test/deps-auto-install.test.js +81 -0
  427. package/out/test/engine-integration.test.js +297 -0
  428. package/out/test/enginePaths.test.js +195 -0
  429. package/out/test/enginePublish.test.js +82 -0
  430. package/out/test/fleetDisplayUtils.test.js +96 -0
  431. package/out/test/gateway-client.test.js +381 -0
  432. package/out/test/gateway-lifecycle.test.js +608 -0
  433. package/out/test/gateway-outbound.test.js +531 -0
  434. package/out/test/gateway-reset-mappings.test.js +221 -0
  435. package/out/test/gateway-route-index.test.js +235 -0
  436. package/out/test/gateway-session-routing.test.js +47 -0
  437. package/out/test/gateway-session-store.test.js +216 -0
  438. package/out/test/github.test.js +232 -0
  439. package/out/test/headless-sync.test.js +279 -0
  440. package/out/test/helpers/manifest-fixtures.js +27 -0
  441. package/out/test/mcp-obo.test.js +82 -0
  442. package/out/test/mcp.test.js +307 -0
  443. package/out/test/openclaw-channel-routing.test.js +191 -0
  444. package/out/test/pathSafety.test.js +63 -0
  445. package/out/test/permissions.test.js +175 -0
  446. package/out/test/persistent-engine-worker.test.js +220 -0
  447. package/out/test/refreshPolicy.test.js +60 -0
  448. package/out/test/registry.test.js +351 -0
  449. package/out/test/runtime.test.js +349 -0
  450. package/out/test/scheduledFleetStorage.test.js +72 -0
  451. package/out/test/serve-hardening.test.js +192 -0
  452. package/out/test/serveClient.test.js +173 -0
  453. package/out/test/sessionJsonlFleet.test.js +78 -0
  454. package/out/test/shared.test.js +173 -0
  455. package/out/test/skills-mcp.test.js +299 -0
  456. package/out/test/spotlightPublish.test.js +299 -0
  457. package/out/test/spotlightYaml.test.js +58 -0
  458. package/out/test/state-sync-peer.test.js +74 -0
  459. package/out/test/store.test.js +331 -0
  460. package/out/test/stores.test.js +504 -0
  461. package/out/test/sync-switch.test.js +251 -0
  462. package/out/test/teamViewDiscovery.test.js +90 -0
  463. package/out/test/toolPath.test.js +120 -0
  464. package/out/test/utils.test.js +308 -0
  465. package/out/test/viewsConfigMerge.test.js +180 -0
  466. package/out/test/windows-command-line.test.js +75 -0
  467. package/out/utils/agentEnvFile.js +131 -0
  468. package/out/utils/binary.js +175 -0
  469. package/out/utils/index.js +37 -0
  470. package/out/utils/network.js +74 -0
  471. package/out/utils/pathSafety.js +60 -0
  472. package/out/utils/paths.js +116 -0
  473. package/out/utils/pid.js +180 -0
  474. package/out/utils/pythonRunner.js +258 -0
  475. package/out/utils/resolveNodeBinary.js +168 -0
  476. package/out/utils/toolPath.js +83 -0
  477. package/out/utils/windowsCommandLine.js +29 -0
  478. package/out/utils.js +915 -0
  479. package/out/workspaceFolders.js +59 -0
  480. package/package.json +41 -0
@@ -0,0 +1,935 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # Copyright (c) AgentHippo.ai. All rights reserved.
4
+ #
5
+ # AgentHippo — Server Gateway Setup
6
+ #
7
+ # Installs OpenClaw Gateway on a server (headless or desktop) so agents
8
+ # can connect from the CLI or IDE and be reached on messaging channels.
9
+ #
10
+ # This script mirrors setup-gateway.sh (IDE-triggered) but adds:
11
+ # - Background start (nohup) or systemd service
12
+ # - Auth token configuration
13
+ # - Remote bind address (0.0.0.0)
14
+ # - Connection info printout
15
+ #
16
+ # Usage:
17
+ # ./setup-gateway-server.sh --source /path/to/openclaw # Local source
18
+ # ./setup-gateway-server.sh --source openclaw/openclaw#branch # Git source
19
+ # ./setup-gateway-server.sh --source openclaw@latest # npm source
20
+ # ./setup-gateway-server.sh --bind 0.0.0.0 --token mysecret # Remote access
21
+ # ./setup-gateway-server.sh --systemd # systemd service
22
+ # ./setup-gateway-server.sh --check # Check status only
23
+ # ./setup-gateway-server.sh --uninstall # stop gateway + remove global openclaw (config kept)
24
+ # ./setup-gateway-server.sh --reinstall --source <src> # uninstall, verify, install (+ start)
25
+ #
26
+
27
+ set -euo pipefail
28
+
29
+ # npm/@npmcli: lifecycle hooks spawn bare `sh`; setPATH can omit /bin if parent PATH is empty.
30
+ export PATH="/usr/bin:/bin:/usr/sbin:/sbin${PATH:+:$PATH}"
31
+ export npm_config_script_shell=/bin/sh
32
+ # Corepack should never block Agent Anywhere setup waiting for interactive approval.
33
+ export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
34
+
35
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
36
+
37
+ # Colors
38
+ RED='\033[0;31m'
39
+ GREEN='\033[0;32m'
40
+ YELLOW='\033[1;33m'
41
+ BLUE='\033[0;34m'
42
+ CYAN='\033[0;36m'
43
+ BOLD='\033[1m'
44
+ NC='\033[0m'
45
+
46
+ # Defaults
47
+ INSTALL_SOURCE="${INSTALL_SOURCE:-}"
48
+ CHECK_ONLY=false
49
+ UNINSTALL=false
50
+ REINSTALL=false
51
+ GATEWAY_PORT="${GATEWAY_PORT:-18789}"
52
+ GATEWAY_BIND="${GATEWAY_BIND:-127.0.0.1}"
53
+ GATEWAY_TOKEN="${GATEWAY_TOKEN:-}"
54
+ INSTALL_SYSTEMD=false
55
+ CONFIG_TEMPLATE="${CONFIG_TEMPLATE:-}"
56
+ START_GATEWAY=true
57
+ PORT_FROM_CLI=false
58
+
59
+ # Parse arguments
60
+ while [[ $# -gt 0 ]]; do
61
+ case "$1" in
62
+ --source|-s)
63
+ INSTALL_SOURCE="$2"
64
+ shift 2
65
+ ;;
66
+ --check|-c)
67
+ CHECK_ONLY=true
68
+ shift
69
+ ;;
70
+ --uninstall)
71
+ UNINSTALL=true
72
+ shift
73
+ ;;
74
+ --reinstall)
75
+ REINSTALL=true
76
+ shift
77
+ ;;
78
+ --port|-p)
79
+ GATEWAY_PORT="$2"
80
+ PORT_FROM_CLI=true
81
+ shift 2
82
+ ;;
83
+ --bind|-b)
84
+ GATEWAY_BIND="$2"
85
+ shift 2
86
+ ;;
87
+ --token|-t)
88
+ GATEWAY_TOKEN="$2"
89
+ shift 2
90
+ ;;
91
+ --systemd)
92
+ INSTALL_SYSTEMD=true
93
+ shift
94
+ ;;
95
+ --no-start)
96
+ START_GATEWAY=false
97
+ shift
98
+ ;;
99
+ --config-template)
100
+ CONFIG_TEMPLATE="$2"
101
+ shift 2
102
+ ;;
103
+ --help|-h)
104
+ echo "Usage: $0 [options]"
105
+ echo ""
106
+ echo "Options:"
107
+ echo " --source, -s <src> npm install source (git repo, local path, or npm package)"
108
+ echo " --check, -c Check installation status only"
109
+ echo " --uninstall Stop gateway, remove global openclaw (~/.openclaw unchanged)"
110
+ echo " --reinstall With --source: uninstall, check, then full install"
111
+ echo " --port, -p <port> Gateway port (default: gateway.port in ~/.openclaw/openclaw.json, else 18789)"
112
+ echo " --bind, -b <addr> Bind address (default: 127.0.0.1, use 0.0.0.0 for remote)"
113
+ echo " --token, -t <token> Auth token for gateway connections"
114
+ echo " --systemd Install and enable systemd user service"
115
+ echo " --no-start Install and configure only, don't start the gateway"
116
+ echo " --config-template <f> Path to starter config template"
117
+ echo " --help, -h Show this help"
118
+ exit 0
119
+ ;;
120
+ *)
121
+ echo "Unknown option: $1"
122
+ exit 1
123
+ ;;
124
+ esac
125
+ done
126
+
127
+ read_openclaw_config_gateway_port() {
128
+ local f="$HOME/.openclaw/openclaw.json"
129
+ [[ -f "$f" ]] || return 1
130
+ command -v node &>/dev/null || return 1
131
+ node -e '
132
+ const fs = require("fs");
133
+ const path = require("path");
134
+ const os = require("os");
135
+ const fp = path.join(os.homedir(), ".openclaw", "openclaw.json");
136
+ if (!fs.existsSync(fp)) process.exit(1);
137
+ let t = fs.readFileSync(fp, "utf8");
138
+ t = t.replace(/^\s*\/\/.*$/gm, "").replace(/,\s*([\]}])/g, "$1");
139
+ try {
140
+ const j = JSON.parse(t);
141
+ const p = j && j.gateway && j.gateway.port;
142
+ if (typeof p === "number" && p >= 1 && p <= 65535) { process.stdout.write(String(p)); process.exit(0); }
143
+ if (typeof p === "string" && /^[0-9]+$/.test(p)) { process.stdout.write(p); process.exit(0); }
144
+ } catch (e) {}
145
+ process.exit(1);
146
+ ' 2>/dev/null
147
+ }
148
+
149
+ if ! $PORT_FROM_CLI; then
150
+ _cfg_port=""
151
+ _cfg_port=$(read_openclaw_config_gateway_port) || true
152
+ if [[ -n "$_cfg_port" ]]; then
153
+ GATEWAY_PORT="$_cfg_port"
154
+ fi
155
+ fi
156
+
157
+ # Logging
158
+ log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
159
+ log_success() { echo -e "${GREEN} ✓${NC} $1"; }
160
+ log_warn() { echo -e "${YELLOW} ✗${NC} $1"; }
161
+ log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
162
+ log_step() { echo -e "\n${BOLD}${CYAN}$1${NC}"; }
163
+
164
+ # Git / GitHub-style sources need a local UI build (published tarballs ship dist/).
165
+ needs_source_build() {
166
+ if [[ -z "$INSTALL_SOURCE" ]]; then
167
+ return 1
168
+ fi
169
+ local s="$INSTALL_SOURCE"
170
+ if [[ "$s" == /* || "$s" == ./* ]]; then
171
+ return 0
172
+ fi
173
+ if [[ "$s" == github:* || "$s" == git+http:* || "$s" == git+https:* ]]; then
174
+ return 0
175
+ fi
176
+ if [[ "$s" == *"#"* ]]; then
177
+ return 0
178
+ fi
179
+ if [[ "$s" =~ ^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$ ]]; then
180
+ return 0
181
+ fi
182
+ return 1
183
+ }
184
+
185
+ needs_pnpm() {
186
+ needs_source_build
187
+ }
188
+
189
+ # Git checkouts omit compiled dist/; build in clone before npm pack so dist/entry.(m)js and control-ui exist.
190
+ install_openclaw_from_remote_git_spec() {
191
+ local spec="$1"
192
+ local s="$spec" ref=""
193
+ if [[ "$s" == *"#"* ]]; then
194
+ ref="${s##*#}"
195
+ s="${s%#*}"
196
+ fi
197
+
198
+ local clone_url=""
199
+ if [[ "$s" == git+https:* || "$s" == git+http:* ]]; then
200
+ clone_url="${s#git+}"
201
+ elif [[ "$s" == github:* ]]; then
202
+ clone_url="https://github.com/${s#github:}.git"
203
+ elif [[ "$s" =~ ^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$ ]]; then
204
+ clone_url="https://github.com/${s}.git"
205
+ else
206
+ log_error "Unsupported git install source: $spec"
207
+ exit 1
208
+ fi
209
+
210
+ local work
211
+ work="$(mktemp -d "${TMPDIR:-/tmp}/openclaw-gateway-src.XXXXXX")"
212
+
213
+ log_info "Cloning $(basename "$clone_url" .git) (shallow) for npm pack install..."
214
+ if [[ -n "$ref" ]]; then
215
+ git clone --depth 1 -b "$ref" "$clone_url" "$work/src" || {
216
+ log_error "git clone failed (check ref and network)"
217
+ rm -rf "$work"
218
+ exit 1
219
+ }
220
+ else
221
+ git clone --depth 1 "$clone_url" "$work/src" || {
222
+ log_error "git clone failed"
223
+ rm -rf "$work"
224
+ exit 1
225
+ }
226
+ fi
227
+
228
+ build_openclaw_in_dir "$work/src" || {
229
+ log_error "OpenClaw build failed in clone (need pnpm, Node 22.12+, network for deps)"
230
+ rm -rf "$work"
231
+ exit 1
232
+ }
233
+
234
+ log_info "npm pack --ignore-scripts ..."
235
+ (cd "$work/src" && npm pack --ignore-scripts) || {
236
+ log_error "npm pack failed"
237
+ rm -rf "$work"
238
+ exit 1
239
+ }
240
+
241
+ local tgz
242
+ tgz="$(ls -t "$work/src"/openclaw-*.tgz 2>/dev/null | head -1)"
243
+ if [[ -z "$tgz" || ! -f "$tgz" ]]; then
244
+ log_error "npm pack did not produce openclaw-*.tgz under clone"
245
+ rm -rf "$work"
246
+ exit 1
247
+ fi
248
+
249
+ log_info "npm install -g $(basename "$tgz") ..."
250
+ npm install -g "$tgz" || {
251
+ log_error "npm install -g tarball failed"
252
+ rm -rf "$work"
253
+ exit 1
254
+ }
255
+
256
+ REMOTE_GATEWAY_CLONE_SRC="$work/src"
257
+ REMOTE_GATEWAY_WORK_DIR="$work"
258
+ }
259
+
260
+ # ============================================================================
261
+ # Check prerequisites (same as setup-gateway.sh)
262
+ # ============================================================================
263
+ check_prerequisites() {
264
+ log_step "Checking prerequisites..."
265
+
266
+ local all_good=true
267
+
268
+ # Node.js >= 22
269
+ if command -v node &>/dev/null; then
270
+ local node_version
271
+ node_version=$(node -v | sed 's/v//' | cut -d. -f1)
272
+ if [[ "$node_version" -ge 22 ]]; then
273
+ log_success "Node.js $(node -v)"
274
+ else
275
+ log_warn "Node.js $(node -v) — version 22+ required"
276
+ all_good=false
277
+ fi
278
+ else
279
+ log_warn "Node.js not found (version 22+ required)"
280
+ echo " Install: https://nodejs.org/ or: curl -fsSL https://fnm.vercel.app/install | bash && fnm install 22"
281
+ all_good=false
282
+ fi
283
+
284
+ # npm
285
+ if command -v npm &>/dev/null; then
286
+ log_success "npm $(npm -v)"
287
+ else
288
+ log_warn "npm not found"
289
+ all_good=false
290
+ fi
291
+
292
+ if needs_pnpm; then
293
+ local src="$INSTALL_SOURCE"
294
+ if [[ "$src" != /* && "$src" != ./* ]]; then
295
+ if command -v git &>/dev/null; then
296
+ log_success "git $(git --version | head -1)"
297
+ else
298
+ log_warn "git not found (required for GitHub / git URL gateway install sources)"
299
+ all_good=false
300
+ fi
301
+ fi
302
+ fi
303
+
304
+ # pnpm (needed for pnpm build + ui:build when installing from git/local source)
305
+ if needs_pnpm; then
306
+ if command -v pnpm &>/dev/null; then
307
+ log_success "pnpm $(pnpm -v)"
308
+ else
309
+ log_warn "pnpm not found (needed to build OpenClaw from source)"
310
+ echo " Install: npm install -g pnpm"
311
+ fi
312
+ else
313
+ log_info "pnpm not required for published package install"
314
+ fi
315
+
316
+ $all_good
317
+ }
318
+
319
+ # ============================================================================
320
+ # Ensure pnpm is available when we need to build the UI
321
+ # ============================================================================
322
+ ensure_pnpm() {
323
+ if command -v pnpm &>/dev/null; then
324
+ log_success "pnpm $(pnpm -v)"
325
+ return 0
326
+ fi
327
+
328
+ log_warn "pnpm not found — attempting to install"
329
+
330
+ if command -v corepack &>/dev/null; then
331
+ log_info "Installing pnpm via corepack..."
332
+ export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
333
+ if corepack prepare pnpm@latest --activate &>/dev/null; then
334
+ if command -v pnpm &>/dev/null; then
335
+ log_success "pnpm $(pnpm -v)"
336
+ return 0
337
+ fi
338
+ fi
339
+ fi
340
+
341
+ if command -v npm &>/dev/null; then
342
+ log_info "Installing pnpm via npm..."
343
+ if npm install -g pnpm; then
344
+ log_success "pnpm $(pnpm -v)"
345
+ return 0
346
+ fi
347
+ fi
348
+
349
+ log_warn "pnpm install failed — skipping web UI build"
350
+ return 1
351
+ }
352
+
353
+ build_openclaw_in_dir() {
354
+ local dir="$1"
355
+ if [[ ! -d "$dir" ]]; then
356
+ log_error "build_openclaw_in_dir: not a directory: $dir"
357
+ return 1
358
+ fi
359
+ ensure_pnpm || {
360
+ log_error "pnpm is required to build OpenClaw from a git checkout"
361
+ return 1
362
+ }
363
+ log_info "pnpm install && pnpm build && pnpm ui:build in $(basename "$dir") (may take several minutes)..."
364
+ (
365
+ cd "$dir" || exit 1
366
+ if [[ ! -f pnpm-lock.yaml ]]; then
367
+ log_error "pnpm-lock.yaml missing — expected an OpenClaw repo checkout"
368
+ exit 1
369
+ fi
370
+ pnpm install || {
371
+ log_error "pnpm install failed"
372
+ exit 1
373
+ }
374
+ pnpm build || {
375
+ log_error "pnpm build failed"
376
+ exit 1
377
+ }
378
+ pnpm ui:build || {
379
+ log_error "pnpm ui:build failed"
380
+ exit 1
381
+ }
382
+ )
383
+ }
384
+
385
+ # ============================================================================
386
+ # Check installed components (extended for server: systemd, bind, token)
387
+ # ============================================================================
388
+ check_installed() {
389
+ log_step "Checking installed components..."
390
+
391
+ local all_ok=true
392
+
393
+ # openclaw binary
394
+ if command -v openclaw &>/dev/null; then
395
+ local oc_version
396
+ oc_version=$(openclaw --version 2>/dev/null | head -1 || echo "unknown")
397
+ log_success "openclaw installed: $oc_version"
398
+ else
399
+ # Check common install locations
400
+ local found=false
401
+ for candidate in \
402
+ "$HOME/Library/pnpm/openclaw" \
403
+ "$HOME/.local/share/pnpm/openclaw" \
404
+ "$HOME/.npm-global/bin/openclaw" \
405
+ "/usr/local/bin/openclaw" \
406
+ "/usr/bin/openclaw"; do
407
+ if [[ -x "$candidate" ]]; then
408
+ local oc_version
409
+ oc_version=$("$candidate" --version 2>/dev/null | head -1 || echo "unknown")
410
+ log_success "openclaw installed at $candidate: $oc_version"
411
+ found=true
412
+ break
413
+ fi
414
+ done
415
+ if ! $found; then
416
+ log_warn "openclaw not installed"
417
+ all_ok=false
418
+ fi
419
+ fi
420
+
421
+ local groot
422
+ groot="$(npm root -g 2>/dev/null)/openclaw"
423
+ if [[ -f "$groot/dist/entry.mjs" || -f "$groot/dist/entry.js" ]]; then
424
+ log_success "CLI dist present ($groot/dist/entry.*)"
425
+ else
426
+ log_warn "CLI dist missing (run setup with source build or reinstall from npm)"
427
+ all_ok=false
428
+ fi
429
+
430
+ # Web UI assets
431
+ local ui_dir
432
+ ui_dir="$groot/dist/control-ui"
433
+ if [[ -f "$ui_dir/index.html" ]]; then
434
+ log_success "Web UI built ($ui_dir)"
435
+ else
436
+ log_warn "Web UI not built"
437
+ all_ok=false
438
+ fi
439
+
440
+ # Gateway running?
441
+ if nc -z 127.0.0.1 "$GATEWAY_PORT" 2>/dev/null; then
442
+ log_success "Gateway running on port $GATEWAY_PORT"
443
+ else
444
+ log_warn "Gateway not running on port $GATEWAY_PORT"
445
+ fi
446
+
447
+ # Config file
448
+ local config_path="$HOME/.openclaw/openclaw.json"
449
+ if [[ -f "$config_path" ]]; then
450
+ log_success "Config file present ($config_path)"
451
+ else
452
+ log_warn "Config file not found ($config_path)"
453
+ fi
454
+
455
+ # systemd service (Linux only)
456
+ if [[ "$(uname)" == "Linux" ]] && command -v systemctl &>/dev/null; then
457
+ if systemctl --user is-enabled openclaw-gateway &>/dev/null 2>&1; then
458
+ local svc_status
459
+ svc_status=$(systemctl --user is-active openclaw-gateway 2>/dev/null || echo "inactive")
460
+ log_success "systemd service: $svc_status"
461
+ elif [[ -f "$HOME/.config/systemd/user/openclaw-gateway.service" ]]; then
462
+ log_warn "systemd service installed but not enabled"
463
+ fi
464
+ fi
465
+
466
+ echo ""
467
+ if $all_ok; then
468
+ echo -e "${GREEN}${BOLD}Gateway is fully installed!${NC}"
469
+ return 0
470
+ else
471
+ echo -e "${YELLOW}${BOLD}Gateway setup is incomplete.${NC}"
472
+ return 1
473
+ fi
474
+ }
475
+
476
+ # ============================================================================
477
+ # Install gateway (same as setup-gateway.sh)
478
+ # ============================================================================
479
+ install_gateway() {
480
+ if [[ -z "$INSTALL_SOURCE" ]]; then
481
+ log_error "No install source specified. Use --source <source>"
482
+ exit 1
483
+ fi
484
+
485
+ REMOTE_GATEWAY_CLONE_SRC=""
486
+ REMOTE_GATEWAY_WORK_DIR=""
487
+
488
+ log_step "Installing OpenClaw Gateway..."
489
+ log_info "Source: $INSTALL_SOURCE"
490
+
491
+ local _npm_root
492
+ _npm_root="$(npm root -g 2>/dev/null || true)"
493
+ if [[ -n "$_npm_root" && -e "$_npm_root/openclaw" ]]; then
494
+ log_info "Removing existing global openclaw tree (avoids partial install / tar errors)..."
495
+ rm -rf "$_npm_root/openclaw"
496
+ fi
497
+
498
+ if needs_source_build; then
499
+ if [[ "$INSTALL_SOURCE" == /* || "$INSTALL_SOURCE" == ./* ]]; then
500
+ local abs_src
501
+ abs_src="$(cd "$INSTALL_SOURCE" && pwd)"
502
+ build_openclaw_in_dir "$abs_src" || exit 1
503
+ npm install -g "$abs_src"
504
+ else
505
+ install_openclaw_from_remote_git_spec "$INSTALL_SOURCE"
506
+ fi
507
+ else
508
+ npm install -g "$INSTALL_SOURCE"
509
+ fi
510
+ log_success "npm install complete"
511
+
512
+ if needs_source_build; then
513
+ if [[ -n "${REMOTE_GATEWAY_WORK_DIR:-}" ]]; then
514
+ log_info "Removing temporary clone directory..."
515
+ rm -rf "$REMOTE_GATEWAY_WORK_DIR"
516
+ REMOTE_GATEWAY_WORK_DIR=""
517
+ REMOTE_GATEWAY_CLONE_SRC=""
518
+ fi
519
+ else
520
+ log_info "Published package — web UI should be pre-built"
521
+ fi
522
+ }
523
+
524
+ # ============================================================================
525
+ # Stop gateway listeners (graceful CLI stop, then best-effort process/port cleanup)
526
+ # ============================================================================
527
+ resolve_openclaw_bin() {
528
+ if command -v openclaw &>/dev/null; then
529
+ command -v openclaw
530
+ return 0
531
+ fi
532
+ local candidate
533
+ for candidate in \
534
+ "$HOME/Library/pnpm/openclaw" \
535
+ "$HOME/.local/share/pnpm/openclaw" \
536
+ "$HOME/.npm-global/bin/openclaw" \
537
+ "/usr/local/bin/openclaw" \
538
+ "/usr/bin/openclaw"; do
539
+ if [[ -x "$candidate" ]]; then
540
+ printf '%s\n' "$candidate"
541
+ return 0
542
+ fi
543
+ done
544
+ return 1
545
+ }
546
+
547
+ free_local_gateway_ports_if_busy() {
548
+ log_step "Clearing local gateway listener(s) if still bound..."
549
+ rm -f "$HOME/.openclaw/gateway.pid" 2>/dev/null || true
550
+ local sweep_ports=("$GATEWAY_PORT")
551
+ [[ "$GATEWAY_PORT" != "18789" ]] && sweep_ports+=(18789)
552
+ local sp pids
553
+ for sp in "${sweep_ports[@]}"; do
554
+ nc -z 127.0.0.1 "$sp" 2>/dev/null || continue
555
+ command -v lsof &>/dev/null || {
556
+ log_warn "Port $sp in use but lsof not available — stop the process manually"
557
+ continue
558
+ }
559
+ log_info "Port $sp in use — stopping listener PID(s)..."
560
+ pids=$(lsof -nP -iTCP:"$sp" -sTCP:LISTEN -t 2>/dev/null | tr '\n' ' ' || true)
561
+ if [[ -n "${pids// }" ]]; then
562
+ # shellcheck disable=SC2086
563
+ kill $pids 2>/dev/null || true
564
+ sleep 1
565
+ pids=$(lsof -nP -iTCP:"$sp" -sTCP:LISTEN -t 2>/dev/null | tr '\n' ' ' || true)
566
+ if [[ -n "${pids// }" ]]; then
567
+ # shellcheck disable=SC2086
568
+ kill -9 $pids 2>/dev/null || true
569
+ fi
570
+ fi
571
+ done
572
+ local any_up=false
573
+ for sp in "${sweep_ports[@]}"; do
574
+ if nc -z 127.0.0.1 "$sp" 2>/dev/null; then
575
+ any_up=true
576
+ break
577
+ fi
578
+ done
579
+ if $any_up; then
580
+ log_warn "A process may still be listening on 127.0.0.1 (${sweep_ports[*]})"
581
+ else
582
+ log_success "Gateway port(s) free on 127.0.0.1 (${sweep_ports[*]})"
583
+ fi
584
+ }
585
+
586
+ # Official teardown: openclaw uninstall --service before npm remove (see docs.openclaw.ai/cli/uninstall).
587
+ openclaw_cli_uninstall_service() {
588
+ local oc_bin=""
589
+ oc_bin=$(resolve_openclaw_bin) || true
590
+ if [[ -z "$oc_bin" ]]; then
591
+ return 0
592
+ fi
593
+ log_step "OpenClaw CLI: uninstall gateway service..."
594
+ log_info "Running: $oc_bin uninstall --service --yes --non-interactive"
595
+ if "$oc_bin" uninstall --service --yes --non-interactive; then
596
+ log_success "openclaw uninstall --service completed"
597
+ else
598
+ log_info "openclaw uninstall --service failed or skipped (continuing)"
599
+ fi
600
+ }
601
+
602
+ # ============================================================================
603
+ # Uninstall gateway (OpenClaw service uninstall + npm global remove + port cleanup)
604
+ # ============================================================================
605
+ uninstall_gateway() {
606
+ openclaw_cli_uninstall_service
607
+ echo ""
608
+ log_step "Uninstalling OpenClaw (global npm package)..."
609
+ if ! command -v npm &>/dev/null; then
610
+ log_error "npm not found"
611
+ exit 1
612
+ fi
613
+ npm uninstall -g openclaw 2>/dev/null || true
614
+ log_success "Ran: npm uninstall -g openclaw (global tree removed if present)"
615
+ log_info "~/.openclaw was not removed (config, sessions, and credentials stay on disk)."
616
+ echo ""
617
+ free_local_gateway_ports_if_busy
618
+ }
619
+
620
+ # ============================================================================
621
+ # Write starter config (extended for server: bind, token, port)
622
+ # ============================================================================
623
+ write_config() {
624
+ local config_path="$HOME/.openclaw/openclaw.json"
625
+
626
+ if [[ -f "$config_path" ]]; then
627
+ log_info "Config already exists at $config_path — skipping"
628
+ return
629
+ fi
630
+
631
+ log_step "Writing starter config..."
632
+ mkdir -p "$HOME/.openclaw"
633
+
634
+ if [[ -n "$CONFIG_TEMPLATE" && -f "$CONFIG_TEMPLATE" ]]; then
635
+ cp "$CONFIG_TEMPLATE" "$config_path"
636
+ log_success "Config written from template: $config_path"
637
+ return
638
+ fi
639
+
640
+ # Build bind mode
641
+ local bind_mode="loopback"
642
+ if [[ "$GATEWAY_BIND" == "0.0.0.0" || "$GATEWAY_BIND" == "::" ]]; then
643
+ bind_mode="any"
644
+ fi
645
+
646
+ # Build auth line
647
+ local auth_line=""
648
+ if [[ -n "$GATEWAY_TOKEN" ]]; then
649
+ auth_line="\"auth\": { \"token\": \"$GATEWAY_TOKEN\" },"
650
+ fi
651
+
652
+ cat > "$config_path" <<CONF
653
+ // OpenClaw Gateway Configuration (JSON5)
654
+ // Docs: https://docs.openclaw.ai/configuration
655
+ // Created by: setup-gateway-server.sh
656
+ {
657
+ "gateway": {
658
+ "mode": "local",
659
+ "port": $GATEWAY_PORT,
660
+ "bind": "$bind_mode",
661
+ ${auth_line}
662
+ "controlUi": { "enabled": true }
663
+ },
664
+ "bindings": [],
665
+ "channels": {},
666
+ "plugins": { "entries": {} },
667
+ "commands": { "nativeSkills": false },
668
+ "session": { "dmScope": "per-peer" },
669
+ "agents": { "defaults": { "maxConcurrent": 4 } }
670
+ }
671
+ CONF
672
+
673
+ chmod 600 "$config_path"
674
+ log_success "Config written: $config_path"
675
+ }
676
+
677
+ # ============================================================================
678
+ # Start gateway (nohup background)
679
+ # ============================================================================
680
+ start_gateway() {
681
+ # Check if already running
682
+ if nc -z 127.0.0.1 "$GATEWAY_PORT" 2>/dev/null; then
683
+ log_info "Gateway already running on port $GATEWAY_PORT"
684
+ return
685
+ fi
686
+
687
+ log_step "Starting gateway..."
688
+
689
+ local openclaw_bin
690
+ openclaw_bin=$(command -v openclaw 2>/dev/null || echo "")
691
+ if [[ -z "$openclaw_bin" ]]; then
692
+ # Check common install locations
693
+ for candidate in \
694
+ "$HOME/Library/pnpm/openclaw" \
695
+ "$HOME/.local/share/pnpm/openclaw" \
696
+ "$HOME/.npm-global/bin/openclaw" \
697
+ "/usr/local/bin/openclaw"; do
698
+ if [[ -x "$candidate" ]]; then
699
+ openclaw_bin="$candidate"
700
+ break
701
+ fi
702
+ done
703
+ fi
704
+
705
+ if [[ -z "$openclaw_bin" ]]; then
706
+ log_error "openclaw binary not found in PATH or common locations"
707
+ return 1
708
+ fi
709
+
710
+ local log_file="$HOME/.openclaw/gateway.log"
711
+ nohup "$openclaw_bin" gateway run \
712
+ --bind "$GATEWAY_BIND" \
713
+ --port "$GATEWAY_PORT" \
714
+ --force \
715
+ > "$log_file" 2>&1 &
716
+
717
+ local pid=$!
718
+ echo "$pid" > "$HOME/.openclaw/gateway.pid"
719
+
720
+ # Wait for it to come up
721
+ local retries=10
722
+ while [[ $retries -gt 0 ]]; do
723
+ if nc -z 127.0.0.1 "$GATEWAY_PORT" 2>/dev/null; then
724
+ log_success "Gateway started (pid=$pid, port=$GATEWAY_PORT)"
725
+ return
726
+ fi
727
+ sleep 1
728
+ retries=$((retries - 1))
729
+ done
730
+
731
+ log_warn "Gateway may not have started. Check: tail -f $log_file"
732
+ }
733
+
734
+ # ============================================================================
735
+ # systemd service (Linux only)
736
+ # ============================================================================
737
+ install_systemd_service() {
738
+ if [[ "$(uname)" != "Linux" ]]; then
739
+ log_warn "systemd is only available on Linux. Use nohup or launchd on macOS."
740
+ return 1
741
+ fi
742
+
743
+ log_step "Installing systemd user service..."
744
+
745
+ local openclaw_bin
746
+ openclaw_bin=$(command -v openclaw 2>/dev/null || echo "")
747
+ if [[ -z "$openclaw_bin" ]]; then
748
+ log_error "openclaw binary not found in PATH"
749
+ return 1
750
+ fi
751
+
752
+ local service_dir="$HOME/.config/systemd/user"
753
+ mkdir -p "$service_dir"
754
+
755
+ local node_bin
756
+ node_bin=$(command -v node 2>/dev/null || echo "/usr/bin/node")
757
+ local node_dir
758
+ node_dir=$(dirname "$node_bin")
759
+
760
+ # Include npm/pnpm bin dirs in PATH so openclaw resolves
761
+ local extra_paths=""
762
+ for dir in \
763
+ "$HOME/Library/pnpm" \
764
+ "$HOME/.local/share/pnpm" \
765
+ "$HOME/.npm-global/bin" \
766
+ "/usr/local/bin"; do
767
+ if [[ -d "$dir" ]]; then
768
+ extra_paths="${extra_paths:+$extra_paths:}$dir"
769
+ fi
770
+ done
771
+
772
+ cat > "$service_dir/openclaw-gateway.service" <<SERVICE
773
+ [Unit]
774
+ Description=OpenClaw Gateway (AgentHippo)
775
+ After=network.target
776
+
777
+ [Service]
778
+ Type=simple
779
+ ExecStart=$openclaw_bin gateway run --bind $GATEWAY_BIND --port $GATEWAY_PORT --force
780
+ Restart=on-failure
781
+ RestartSec=5
782
+ Environment=PATH=$node_dir:${extra_paths:+$extra_paths:}/usr/local/bin:/usr/bin:/bin
783
+ Environment=HOME=$HOME
784
+ WorkingDirectory=$HOME
785
+
786
+ [Install]
787
+ WantedBy=default.target
788
+ SERVICE
789
+
790
+ systemctl --user daemon-reload
791
+ systemctl --user enable openclaw-gateway
792
+ systemctl --user start openclaw-gateway
793
+
794
+ log_success "systemd service installed and started"
795
+ echo ""
796
+ echo -e " ${CYAN}Status:${NC} systemctl --user status openclaw-gateway"
797
+ echo -e " ${CYAN}Logs:${NC} journalctl --user -u openclaw-gateway -f"
798
+ echo -e " ${CYAN}Stop:${NC} systemctl --user stop openclaw-gateway"
799
+ echo -e " ${CYAN}Restart:${NC} systemctl --user restart openclaw-gateway"
800
+
801
+ # Enable lingering so service runs after SSH logout
802
+ if command -v loginctl &>/dev/null; then
803
+ loginctl enable-linger "$(whoami)" 2>/dev/null || true
804
+ log_success "Lingering enabled (service persists after SSH logout)"
805
+ fi
806
+ }
807
+
808
+ # ============================================================================
809
+ # Print connection info
810
+ # ============================================================================
811
+ print_connection_info() {
812
+ log_step "Connection info"
813
+
814
+ local host
815
+ if [[ "$GATEWAY_BIND" == "0.0.0.0" || "$GATEWAY_BIND" == "::" ]]; then
816
+ host=$(hostname -f 2>/dev/null || hostname 2>/dev/null || echo "your-server")
817
+ else
818
+ host="127.0.0.1"
819
+ fi
820
+
821
+ echo ""
822
+ echo -e " ${BOLD}Gateway URL:${NC} ws://$host:$GATEWAY_PORT"
823
+ if [[ -n "$GATEWAY_TOKEN" ]]; then
824
+ echo -e " ${BOLD}Auth token:${NC} $GATEWAY_TOKEN"
825
+ fi
826
+ echo -e " ${BOLD}Web UI:${NC} http://$host:$GATEWAY_PORT"
827
+ echo ""
828
+ echo -e " ${CYAN}Connect from AgentHippo CLI:${NC}"
829
+ echo -e " export OPENCLAW_GATEWAY_URL=ws://$host:$GATEWAY_PORT"
830
+ if [[ -n "$GATEWAY_TOKEN" ]]; then
831
+ echo -e " export OPENCLAW_GATEWAY_TOKEN=$GATEWAY_TOKEN"
832
+ fi
833
+ echo -e " agenthippo serve -a myagent --bind telegram,whatsapp"
834
+ echo ""
835
+ echo -e " ${CYAN}Connect from VS Code (AgentHippo IDE):${NC}"
836
+ echo -e " Set agentide.gateway.url = ws://$host:$GATEWAY_PORT"
837
+ if [[ -n "$GATEWAY_TOKEN" ]]; then
838
+ echo -e " Set agentide.gateway.token = $GATEWAY_TOKEN"
839
+ fi
840
+ echo ""
841
+ }
842
+
843
+ # ============================================================================
844
+ # Main
845
+ # ============================================================================
846
+
847
+ echo -e "${BOLD}${CYAN}"
848
+ echo " ╔═══════════════════════════════════════╗"
849
+ echo " ║ AgentHippo Gateway (Server) ║"
850
+ echo " ║ Reach your agents from anywhere ║"
851
+ echo " ╚═══════════════════════════════════════╝"
852
+ echo -e "${NC}"
853
+
854
+ if $CHECK_ONLY; then
855
+ check_installed
856
+ exit $?
857
+ fi
858
+
859
+ if $REINSTALL; then
860
+ if [[ -z "$INSTALL_SOURCE" ]]; then
861
+ log_error "--reinstall requires --source <src> (or set INSTALL_SOURCE)"
862
+ exit 1
863
+ fi
864
+ log_step "Reinstall: uninstall → verify → install"
865
+ uninstall_gateway
866
+ echo ""
867
+ log_step "Post-uninstall verification (--check)..."
868
+ check_installed || true
869
+ echo ""
870
+ if ! check_prerequisites; then
871
+ echo ""
872
+ log_error "Prerequisites not met. Install the missing tools and try again."
873
+ exit 1
874
+ fi
875
+ echo ""
876
+ install_gateway
877
+ write_config
878
+ if $START_GATEWAY; then
879
+ if $INSTALL_SYSTEMD; then
880
+ install_systemd_service
881
+ else
882
+ start_gateway
883
+ fi
884
+ fi
885
+ echo ""
886
+ check_installed || true
887
+ print_connection_info
888
+ echo -e "${BOLD}Reinstall complete.${NC}"
889
+ echo ""
890
+ exit 0
891
+ fi
892
+
893
+ if $UNINSTALL; then
894
+ uninstall_gateway
895
+ echo ""
896
+ check_installed || true
897
+ exit 0
898
+ fi
899
+
900
+ # Prerequisites
901
+ if ! check_prerequisites; then
902
+ echo ""
903
+ log_error "Prerequisites not met. Install the missing tools and try again."
904
+ exit 1
905
+ fi
906
+
907
+ # Install if not present
908
+ if ! command -v openclaw &>/dev/null; then
909
+ echo ""
910
+ install_gateway
911
+ fi
912
+
913
+ # Write config if missing
914
+ write_config
915
+
916
+ # Start the gateway
917
+ if $START_GATEWAY; then
918
+ if $INSTALL_SYSTEMD; then
919
+ install_systemd_service
920
+ else
921
+ start_gateway
922
+ fi
923
+ fi
924
+
925
+ # Final status
926
+ echo ""
927
+ check_installed || true
928
+
929
+ # Print connection info
930
+ print_connection_info
931
+
932
+ echo -e "${BOLD}Done!${NC} Next steps:"
933
+ echo -e " 1. Set up channels: open ${CYAN}http://${GATEWAY_BIND}:${GATEWAY_PORT}${NC} or edit ${CYAN}~/.openclaw/openclaw.json${NC}"
934
+ echo -e " 2. Connect your agent: ${CYAN}agenthippo serve -a myagent --bind telegram${NC}"
935
+ echo ""