@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,700 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # Starts LiteLLM via uv. By default installs litellm[proxy] from PyPI (pinned version).
4
+ # Use --git or LITELLM_FROM_GIT=true to install from GitHub at DEFAULT_LITELLM_VERSION instead.
5
+ # LITELLM_UV_WITH overrides both (space-separated uv --with package specs).
6
+
7
+ set -euo pipefail
8
+
9
+ # Prepend common tool install locations so uv is discoverable when this script
10
+ # runs from a GUI-launched context (VS Code task, IDE-spawned Git Bash on
11
+ # Windows) where the inherited PATH is minimal. Mirrors
12
+ # extensions/agentide/src/utils/toolPath.ts.
13
+ augment_path_for_tools() {
14
+ local extra
15
+ local candidates=(
16
+ "$HOME/.local/bin"
17
+ "$HOME/.cargo/bin"
18
+ "$HOME/.uv/bin"
19
+ "/opt/homebrew/bin"
20
+ "/usr/local/bin"
21
+ "/home/linuxbrew/.linuxbrew/bin"
22
+ )
23
+ # Git Bash / MSYS / Cygwin on Windows: add Windows-style install locations
24
+ # translated to unix paths (Git Bash mounts C: as /c, etc.).
25
+ case "${OSTYPE:-}" in
26
+ msys*|cygwin*|win32*)
27
+ if [ -n "${LOCALAPPDATA:-}" ]; then
28
+ local localappdata_unix
29
+ localappdata_unix="$(printf '%s' "$LOCALAPPDATA" | sed -e 's|\\|/|g' -e 's|^\([A-Za-z]\):|/\L\1|')"
30
+ candidates+=(
31
+ "$localappdata_unix/Microsoft/WinGet/Links"
32
+ "$localappdata_unix/Programs/uv"
33
+ )
34
+ fi
35
+ candidates+=(
36
+ "$HOME/scoop/shims"
37
+ "/c/Program Files/uv"
38
+ )
39
+ ;;
40
+ esac
41
+ for extra in "${candidates[@]}"; do
42
+ if [ -d "$extra" ] && [[ ":$PATH:" != *":$extra:"* ]]; then
43
+ PATH="$extra:$PATH"
44
+ fi
45
+ done
46
+ export PATH
47
+ }
48
+ augment_path_for_tools
49
+
50
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
51
+ DEFAULT_CONFIG_PATH="${SCRIPT_DIR}/analytics/agentide-litellm-otel.config.yaml"
52
+ DEFAULT_LITELLM_VERSION="${DEFAULT_LITELLM_VERSION:-1.85.0}"
53
+ # Resolve branded home dir from env first, then legacy fallbacks.
54
+ AGENT_HOME_DIR="${AGENT_HOME_DIR:-${AGENTHIPPO_HOME:-$HOME/.agent-hippo}}"
55
+ DEFAULT_ENV_FILE="${AGENT_HOME_DIR}/.env"
56
+ DEFAULT_TLS_DIR="${AGENT_HOME_DIR}/litellm-tls"
57
+
58
+ CONFIG_PATH="${LITELLM_CONFIG_PATH:-$DEFAULT_CONFIG_PATH}"
59
+ ENV_FILE="${LITELLM_ENV_FILE:-$DEFAULT_ENV_FILE}"
60
+ HOST="${LITELLM_HOST:-127.0.0.1}"
61
+
62
+ STOP_MODE=false
63
+ FROM_GIT_CLI=false
64
+ SHOW_HELP=false
65
+ EXTRA_ARGS=()
66
+
67
+ while [[ $# -gt 0 ]]; do
68
+ case "$1" in
69
+ --stop)
70
+ STOP_MODE=true
71
+ shift
72
+ ;;
73
+ --config)
74
+ CONFIG_PATH="$2"
75
+ shift 2
76
+ ;;
77
+ --git)
78
+ FROM_GIT_CLI=true
79
+ shift
80
+ ;;
81
+ --help|-h)
82
+ SHOW_HELP=true
83
+ shift
84
+ ;;
85
+ *)
86
+ EXTRA_ARGS+=("$1")
87
+ shift
88
+ ;;
89
+ esac
90
+ done
91
+
92
+ if [[ "$SHOW_HELP" == true ]]; then
93
+ cat <<EOF
94
+ Usage: $(basename "$0") [options] [extra args passed to litellm...]
95
+
96
+ Start the LiteLLM proxy using uv (https://docs.astral.sh/uv/).
97
+
98
+ Options:
99
+ --config PATH Config YAML (default: LITELLM_CONFIG_PATH or analytics/agentide-litellm-otel.config.yaml)
100
+ --stop Stop using litellm.pid under AGENT_HOME_DIR
101
+ --git Install litellm[proxy] from GitHub (tag from DEFAULT_LITELLM_VERSION; default ${DEFAULT_LITELLM_VERSION}) instead of PyPI
102
+ -h, --help Show this help
103
+
104
+ Environment (common):
105
+ DEFAULT_LITELLM_VERSION PyPI version / git ref (default: ${DEFAULT_LITELLM_VERSION})
106
+ LITELLM_PYTHON_VERSION Python version for uv (default: 3.12)
107
+ LITELLM_FROM_GIT true to use GitHub install like --git (e.g. from .env)
108
+ LITELLM_UV_WITH Overrides package source entirely (space-separated uv --with specs)
109
+ EOF
110
+ exit 0
111
+ fi
112
+
113
+ normalize_bool() {
114
+ local value="${1:-false}"
115
+ value="$(printf '%s' "$value" | tr '[:upper:]' '[:lower:]')"
116
+ case "$value" in
117
+ 1|true|yes|on) return 0 ;;
118
+ *) return 1 ;;
119
+ esac
120
+ }
121
+
122
+ get_windows_listener_pid() {
123
+ local port="$1"
124
+ if ! command -v powershell.exe >/dev/null 2>&1; then
125
+ return 1
126
+ fi
127
+
128
+ powershell.exe -NoProfile -Command "\$p = Get-NetTCPConnection -LocalPort ${port} -State Listen -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty OwningProcess; if (\$p) { Write-Output \$p }" 2>/dev/null | tr -d '\r'
129
+ }
130
+
131
+ get_listener_pids() {
132
+ local port="$1"
133
+ local pids=""
134
+ if command -v lsof >/dev/null 2>&1; then
135
+ pids="$(lsof -tiTCP:"${port}" -sTCP:LISTEN 2>/dev/null || true)"
136
+ elif command -v fuser >/dev/null 2>&1; then
137
+ pids="$(fuser "${port}/tcp" 2>/dev/null || true)"
138
+ fi
139
+
140
+ if [[ -z "$pids" ]]; then
141
+ return 1
142
+ fi
143
+
144
+ printf '%s\n' $pids
145
+ }
146
+
147
+ port_in_use() {
148
+ local port="$1"
149
+ get_listener_pids "$port" >/dev/null 2>&1
150
+ }
151
+
152
+ process_cmdline() {
153
+ local pid="$1"
154
+ ps -p "$pid" -o command= 2>/dev/null || true
155
+ }
156
+
157
+ cmdline_matches_litellm() {
158
+ local cmdline="$1"
159
+ local config_path="$2"
160
+ local port="$3"
161
+
162
+ if [[ "$cmdline" != *litellm* ]]; then
163
+ return 1
164
+ fi
165
+
166
+ if [[ -n "$config_path" && "$cmdline" == *"$config_path"* ]]; then
167
+ return 0
168
+ fi
169
+
170
+ if [[ "$cmdline" =~ (^|[[:space:]])--port[[:space:]]+${port}([[:space:]]|$) ]]; then
171
+ return 0
172
+ fi
173
+
174
+ return 1
175
+ }
176
+
177
+ stop_litellm_pid() {
178
+ local pid="$1"
179
+ if [[ -z "$pid" ]]; then
180
+ return 1
181
+ fi
182
+ if ! kill -0 "$pid" 2>/dev/null; then
183
+ return 1
184
+ fi
185
+
186
+ echo "Stopping LiteLLM (PID: $pid)"
187
+ kill "$pid" 2>/dev/null || true
188
+ sleep 1
189
+ if kill -0 "$pid" 2>/dev/null; then
190
+ kill -9 "$pid" 2>/dev/null || true
191
+ fi
192
+ return 0
193
+ }
194
+
195
+ stop_litellm_matches() {
196
+ local config_path="$1"
197
+ local port="$2"
198
+ local stopped=1
199
+ local seen=" "
200
+
201
+ local pids
202
+ pids="$(pgrep -f "litellm" 2>/dev/null || true)"
203
+ for pid in $pids; do
204
+ if [[ "$pid" == "$$" || "$seen" == *" $pid "* ]]; then
205
+ continue
206
+ fi
207
+ local cmdline
208
+ cmdline="$(process_cmdline "$pid")"
209
+ if cmdline_matches_litellm "$cmdline" "$config_path" "$port"; then
210
+ seen="${seen}${pid} "
211
+ stop_litellm_pid "$pid" && stopped=0
212
+ fi
213
+ done
214
+
215
+ pids="$(get_listener_pids "$port" 2>/dev/null || true)"
216
+ for pid in $pids; do
217
+ if [[ "$pid" == "$$" || "$seen" == *" $pid "* ]]; then
218
+ continue
219
+ fi
220
+ local cmdline
221
+ cmdline="$(process_cmdline "$pid")"
222
+ if cmdline_matches_litellm "$cmdline" "$config_path" "$port"; then
223
+ seen="${seen}${pid} "
224
+ stop_litellm_pid "$pid" && stopped=0
225
+ fi
226
+ done
227
+
228
+ return "$stopped"
229
+ }
230
+
231
+ ensure_mkcert() {
232
+ if command -v mkcert >/dev/null 2>&1; then
233
+ return 0
234
+ fi
235
+
236
+ echo "mkcert not found. Attempting to install..." >&2
237
+ if command -v brew >/dev/null 2>&1; then
238
+ echo "Installing mkcert via Homebrew (may prompt for password)..." >&2
239
+ if brew list mkcert >/dev/null 2>&1; then
240
+ brew upgrade mkcert
241
+ else
242
+ brew install mkcert
243
+ fi
244
+ else
245
+ echo "Homebrew not found. Please install mkcert manually: https://github.com/FiloSottile/mkcert" >&2
246
+ exit 1
247
+ fi
248
+
249
+ if ! command -v mkcert >/dev/null 2>&1; then
250
+ echo "mkcert installation failed. Install manually and re-run." >&2
251
+ exit 1
252
+ fi
253
+ }
254
+
255
+ if normalize_bool "${LITELLM_ENABLE_TLS:-false}"; then
256
+ DEFAULT_PORT=4443
257
+ TLS_ENABLED=true
258
+ else
259
+ DEFAULT_PORT=4000
260
+ TLS_ENABLED=false
261
+ fi
262
+
263
+ PORT="${LITELLM_PORT:-$DEFAULT_PORT}"
264
+ SCHEME=$([[ "$TLS_ENABLED" == true ]] && echo "https" || echo "http")
265
+ TLS_CERT="${LITELLM_TLS_CERT:-${DEFAULT_TLS_DIR}/localhost.pem}"
266
+ TLS_KEY="${LITELLM_TLS_KEY:-${DEFAULT_TLS_DIR}/localhost-key.pem}"
267
+ LITELLM_URL="${SCHEME}://${HOST}:${PORT}"
268
+
269
+ if [[ -f "$ENV_FILE" ]]; then
270
+ echo "Loading environment variables from ${ENV_FILE}"
271
+ set -a
272
+ # shellcheck disable=SC1090
273
+ source "$ENV_FILE"
274
+ set +a
275
+ fi
276
+
277
+ if [[ "$STOP_MODE" == true ]]; then
278
+ PID_FILE="${AGENT_HOME_DIR}/litellm.pid"
279
+ STOP_CONFIG_PATH="$CONFIG_PATH"
280
+ STOPPED=false
281
+ if [[ -f "$PID_FILE" ]]; then
282
+ while IFS= read -r line; do
283
+ if [[ "$line" == config=* ]]; then
284
+ STOP_CONFIG_PATH="${line#config=}"
285
+ break
286
+ fi
287
+ done < "$PID_FILE"
288
+ fi
289
+ if [[ -f "$PID_FILE" ]]; then
290
+ PID=$(head -n 1 "$PID_FILE" | tr -d "\r")
291
+ if [[ -n "$PID" ]]; then
292
+ if [[ -d "/proc/${PID}" ]]; then
293
+ stop_litellm_pid "$PID" && STOPPED=true || true
294
+ elif command -v taskkill.exe >/dev/null 2>&1; then
295
+ echo "Stopping LiteLLM (PID: $PID)"
296
+ taskkill.exe /PID "$PID" /T /F >/dev/null 2>&1 || true
297
+ STOPPED=true
298
+ else
299
+ stop_litellm_pid "$PID" && STOPPED=true || true
300
+ fi
301
+ fi
302
+ rm -f "$PID_FILE" 2>/dev/null || true
303
+ fi
304
+
305
+ if stop_litellm_matches "$STOP_CONFIG_PATH" "$PORT"; then
306
+ STOPPED=true
307
+ rm -f "$PID_FILE" 2>/dev/null || true
308
+ exit 0
309
+ fi
310
+
311
+ if [[ "$STOPPED" == false ]]; then
312
+ echo "LiteLLM PID file not found. Nothing to stop."
313
+ fi
314
+ exit 0
315
+ fi
316
+
317
+ if [[ "$TLS_ENABLED" == true ]]; then
318
+ mkdir -p "$DEFAULT_TLS_DIR"
319
+ if [[ ! -f "$TLS_CERT" || ! -f "$TLS_KEY" ]]; then
320
+ ensure_mkcert
321
+ echo "Generating development TLS certificate via mkcert at ${DEFAULT_TLS_DIR}"
322
+ mkcert -install >/dev/null 2>&1 || true
323
+ mkcert -cert-file "$TLS_CERT" -key-file "$TLS_KEY" localhost 127.0.0.1 ::1
324
+ fi
325
+ fi
326
+
327
+ if [[ ! -f "$CONFIG_PATH" ]]; then
328
+ echo "LiteLLM config not found at ${CONFIG_PATH}. Update LITELLM_CONFIG_PATH or create the file." >&2
329
+ exit 1
330
+ fi
331
+
332
+ # LiteLLM 1.85+ resolves custom callback modules beside the config file (not only PYTHONPATH).
333
+ sync_agentide_litellm_hooks_beside_config() {
334
+ local config_dir="$1"
335
+ local hooks_src="${SCRIPT_DIR}/agentide_litellm_hooks_v1.py"
336
+ local hooks_dest="${config_dir}/agentide_litellm_hooks_v1.py"
337
+ if [[ ! -f "$hooks_src" ]]; then
338
+ return 0
339
+ fi
340
+ if ! grep -q 'agentide_litellm_hooks_v1' "$CONFIG_PATH"; then
341
+ return 0
342
+ fi
343
+ if [[ ! -f "$hooks_dest" ]] || ! cmp -s "$hooks_src" "$hooks_dest"; then
344
+ cp "$hooks_src" "$hooks_dest"
345
+ fi
346
+ }
347
+ sync_agentide_litellm_hooks_beside_config "$(dirname "$CONFIG_PATH")"
348
+
349
+ # User-owned ~/.agent-hippo/litellm-otel.yaml is not auto-replaced; merge required proxy callbacks.
350
+ ensure_codex_proxy_callback_in_config() {
351
+ local template="${SCRIPT_DIR}/analytics/agentide-litellm-otel.config.yaml"
352
+ if [[ ! -f "$CONFIG_PATH" ]] || [[ ! -f "$template" ]]; then
353
+ return 0
354
+ fi
355
+ if ! grep -q 'agentide_litellm_hooks_v1' "$CONFIG_PATH"; then
356
+ return 0
357
+ fi
358
+ if grep -q 'codex_proxy_sanitizer' "$CONFIG_PATH"; then
359
+ return 0
360
+ fi
361
+ local template_callbacks
362
+ template_callbacks="$(grep -E '^[[:space:]]*callbacks:' "$template" | tail -1)"
363
+ if [[ -z "$template_callbacks" ]]; then
364
+ return 0
365
+ fi
366
+ local tmp_config="${CONFIG_PATH}.tmp.$$"
367
+ if ! grep -E '^[[:space:]]*callbacks:' "$CONFIG_PATH" >/dev/null; then
368
+ return 0
369
+ fi
370
+ awk -v repl="$template_callbacks" '
371
+ /^[[:space:]]*callbacks:/ { print repl; next }
372
+ { print }
373
+ ' "$CONFIG_PATH" >"$tmp_config" && mv "$tmp_config" "$CONFIG_PATH"
374
+ echo " config : patched callbacks (added codex_proxy_sanitizer)"
375
+ }
376
+ ensure_codex_proxy_callback_in_config
377
+
378
+ stop_litellm_matches "$CONFIG_PATH" "$PORT" || true
379
+ sleep 1
380
+ if port_in_use "$PORT"; then
381
+ echo "LiteLLM port ${PORT} is still in use. Stop the existing process and retry." >&2
382
+ exit 1
383
+ fi
384
+
385
+ CHILD_PATH_SEP=':'
386
+ SHELL_AGENT_HOME_DIR="$AGENT_HOME_DIR"
387
+ CHILD_AGENT_HOME_DIR="$AGENT_HOME_DIR"
388
+ CHILD_CONFIG_PATH="$CONFIG_PATH"
389
+ CHILD_SCRIPT_DIR="$SCRIPT_DIR"
390
+ CHILD_TLS_CERT="$TLS_CERT"
391
+ CHILD_TLS_KEY="$TLS_KEY"
392
+ if command -v cygpath >/dev/null 2>&1; then
393
+ case "$(uname -s)" in
394
+ MINGW*|MSYS*|CYGWIN*)
395
+ CHILD_PATH_SEP=';'
396
+ CHILD_AGENT_HOME_DIR="$(cygpath -w "$AGENT_HOME_DIR")"
397
+ CHILD_CONFIG_PATH="$(cygpath -w "$CONFIG_PATH")"
398
+ CHILD_SCRIPT_DIR="$(cygpath -w "$SCRIPT_DIR")"
399
+ if [[ -n "$TLS_CERT" ]]; then
400
+ CHILD_TLS_CERT="$(cygpath -w "$TLS_CERT")"
401
+ fi
402
+ if [[ -n "$TLS_KEY" ]]; then
403
+ CHILD_TLS_KEY="$(cygpath -w "$TLS_KEY")"
404
+ fi
405
+ ;;
406
+ esac
407
+ fi
408
+
409
+ if grep -q 'OPENAI_API_KEY' "$CONFIG_PATH" && [[ -z "${OPENAI_API_KEY:-}" ]]; then
410
+ echo "OPENAI_API_KEY is not set but the config references it. Export OPENAI_API_KEY before running this script." >&2
411
+ exit 1
412
+ fi
413
+
414
+ LANGFUSE_CALLBACK_PRESENT=false
415
+ LANGFUSE_SHOULD_INSTALL=false
416
+ AGENTOPS_CALLBACK_PRESENT=false
417
+ AGENTOPS_SHOULD_INSTALL=false
418
+ OTEL_CALLBACK_PRESENT=false
419
+ OTEL_SHOULD_INSTALL=false
420
+
421
+ # Check Langfuse configuration if callbacks include langfuse
422
+ if grep -q 'callbacks.*langfuse' "$CONFIG_PATH" || grep -q 'callbacks:.*\[.*langfuse' "$CONFIG_PATH"; then
423
+ LANGFUSE_CALLBACK_PRESENT=true
424
+ if normalize_bool "${LITELLM_DISABLE_LANGFUSE:-false}"; then
425
+ echo " langfuse: disabled (LITELLM_DISABLE_LANGFUSE=true)"
426
+ else
427
+ LANGFUSE_SHOULD_INSTALL=true
428
+ if [[ -z "${LANGFUSE_SECRET_KEY:-}" ]] || [[ -z "${LANGFUSE_PUBLIC_KEY:-}" ]]; then
429
+ echo ""
430
+ echo "⚠️ Langfuse is enabled but credentials are missing!" >&2
431
+ echo " Set LANGFUSE_SECRET_KEY and LANGFUSE_PUBLIC_KEY in ${ENV_FILE}" >&2
432
+ echo " Or use cloud.langfuse.com to get your keys." >&2
433
+ echo " See scripts/LANGFUSE_SETUP.md for setup instructions." >&2
434
+ echo ""
435
+ echo " To disable Langfuse, set LITELLM_DISABLE_LANGFUSE=true" >&2
436
+ echo " or comment out 'callbacks: [\"langfuse\"]' in the config." >&2
437
+ echo ""
438
+ else
439
+ LANGFUSE_HOST="${LANGFUSE_HOST:-https://cloud.langfuse.com}"
440
+ echo " langfuse: enabled (${LANGFUSE_HOST})"
441
+ fi
442
+ fi
443
+ fi
444
+
445
+ # Check OpenTelemetry configuration if callbacks include otel
446
+ if grep -q 'callbacks.*otel' "$CONFIG_PATH" || grep -q 'callbacks:.*\[.*otel' "$CONFIG_PATH"; then
447
+ OTEL_CALLBACK_PRESENT=true
448
+ if normalize_bool "${LITELLM_DISABLE_OTEL:-false}"; then
449
+ echo " otel: disabled (LITELLM_DISABLE_OTEL=true)"
450
+ else
451
+ OTEL_SHOULD_INSTALL=true
452
+ echo " otel: enabled"
453
+ fi
454
+ fi
455
+
456
+ # Provide OTEL defaults when OTEL callback is enabled
457
+ if [[ "$OTEL_SHOULD_INSTALL" == true ]]; then
458
+ : "${OTEL_EXPORTER:=otlp_http}"
459
+ : "${OTEL_EXPORTER_OTLP_ENDPOINT:=http://localhost:4318}"
460
+ # Reduce Python OTEL SDK batch delay for faster trace visibility (default: 5000ms)
461
+ : "${OTEL_BSP_SCHEDULE_DELAY:=500}"
462
+ export OTEL_EXPORTER
463
+ export OTEL_EXPORTER_OTLP_ENDPOINT
464
+ export OTEL_BSP_SCHEDULE_DELAY
465
+ fi
466
+
467
+ # Check AgentOps configuration if callbacks include agentops
468
+ if grep -q 'callbacks.*agentops' "$CONFIG_PATH" || grep -q 'callbacks:.*\[.*agentops' "$CONFIG_PATH"; then
469
+ AGENTOPS_CALLBACK_PRESENT=true
470
+ if normalize_bool "${LITELLM_DISABLE_AGENTOPS:-false}"; then
471
+ echo " agentops: disabled (LITELLM_DISABLE_AGENTOPS=true)"
472
+ else
473
+ AGENTOPS_SHOULD_INSTALL=true
474
+ if [[ -z "${AGENTOPS_API_KEY:-}" ]]; then
475
+ echo ""
476
+ echo "⚠️ AgentOps callback is enabled but AGENTOPS_API_KEY is missing!" >&2
477
+ echo " Set AGENTOPS_API_KEY in ${ENV_FILE} (or export it) before running the proxy." >&2
478
+ echo ""
479
+ else
480
+ echo " agentops: enabled"
481
+ fi
482
+ fi
483
+ fi
484
+
485
+ if ! command -v uv >/dev/null 2>&1; then
486
+ echo "uv (https://docs.astral.sh/uv/) is required. Install with 'brew install uv' or follow the official instructions." >&2
487
+ exit 1
488
+ fi
489
+
490
+ # Default to Python 3.12 for deterministic dependency resolution (e.g. mcp.types support).
491
+ LITELLM_PYTHON_VERSION="${LITELLM_PYTHON_VERSION:-3.12}"
492
+ UV_ARGS=()
493
+ if [[ -n "${LITELLM_PYTHON_VERSION:-}" ]]; then
494
+ UV_ARGS+=(--python "${LITELLM_PYTHON_VERSION}")
495
+ fi
496
+
497
+ LITELLM_PACKAGE_SOURCE="pypi"
498
+ if [[ -n "${LITELLM_UV_WITH:-}" ]]; then
499
+ read -r -a UV_WITH_ARRAY <<<"${LITELLM_UV_WITH}"
500
+ LITELLM_PACKAGE_SOURCE="custom (LITELLM_UV_WITH)"
501
+ elif [[ "$FROM_GIT_CLI" == true ]] || normalize_bool "${LITELLM_FROM_GIT:-false}"; then
502
+ UV_WITH_ARRAY=("litellm[proxy] @ git+https://github.com/BerriAI/litellm.git@${DEFAULT_LITELLM_VERSION}")
503
+ LITELLM_PACKAGE_SOURCE="git @ ${DEFAULT_LITELLM_VERSION}"
504
+ else
505
+ UV_WITH_ARRAY=("litellm[proxy]==${DEFAULT_LITELLM_VERSION}")
506
+ LITELLM_PACKAGE_SOURCE="pypi ==${DEFAULT_LITELLM_VERSION}"
507
+ fi
508
+
509
+ if [[ "$LANGFUSE_SHOULD_INSTALL" == true ]]; then
510
+ LANGFUSE_SPEC="${LITELLM_LANGFUSE_SPEC:-langfuse>=2.60.10,<3.0.0}"
511
+ HAS_LANGFUSE_SPEC=false
512
+ for pkg in "${UV_WITH_ARRAY[@]}"; do
513
+ if [[ "$pkg" == langfuse* ]]; then
514
+ HAS_LANGFUSE_SPEC=true
515
+ break
516
+ fi
517
+ done
518
+ if [[ "$HAS_LANGFUSE_SPEC" == false ]]; then
519
+ UV_WITH_ARRAY+=("$LANGFUSE_SPEC")
520
+ fi
521
+ fi
522
+
523
+ # Install OpenTelemetry packages if otel callback is enabled
524
+ # All OpenTelemetry packages must be at compatible versions to avoid import errors
525
+ if [[ "$OTEL_SHOULD_INSTALL" == true ]] || [[ "$AGENTOPS_SHOULD_INSTALL" == true ]]; then
526
+ # Use compatible versions - all OpenTelemetry packages should be at the same version
527
+ OTEL_VERSION="${LITELLM_OTEL_VERSION:-1.25.0}"
528
+ OTEL_API_SPEC="${LITELLM_OTEL_API_SPEC:-opentelemetry-api>=${OTEL_VERSION},<2.0.0}"
529
+ OTEL_SDK_SPEC="${LITELLM_OTEL_SDK_SPEC:-opentelemetry-sdk>=${OTEL_VERSION},<2.0.0}"
530
+ OTEL_EXPORTER_OTLP_GRPC_SPEC="${LITELLM_OTEL_EXPORTER_OTLP_GRPC_SPEC:-opentelemetry-exporter-otlp-proto-grpc>=${OTEL_VERSION},<2.0.0}"
531
+ OTEL_EXPORTER_OTLP_HTTP_SPEC="${LITELLM_OTEL_EXPORTER_OTLP_HTTP_SPEC:-opentelemetry-exporter-otlp-proto-http>=${OTEL_VERSION},<2.0.0}"
532
+
533
+ HAS_OTEL_API=false
534
+ HAS_OTEL_SDK=false
535
+ HAS_OTEL_EXPORTER_GRPC=false
536
+ HAS_OTEL_EXPORTER_HTTP=false
537
+
538
+ for pkg in "${UV_WITH_ARRAY[@]}"; do
539
+ if [[ "$pkg" == opentelemetry-api* ]]; then
540
+ HAS_OTEL_API=true
541
+ fi
542
+ if [[ "$pkg" == opentelemetry-sdk* ]]; then
543
+ HAS_OTEL_SDK=true
544
+ fi
545
+ if [[ "$pkg" == opentelemetry-exporter-otlp-proto-grpc* ]]; then
546
+ HAS_OTEL_EXPORTER_GRPC=true
547
+ fi
548
+ if [[ "$pkg" == opentelemetry-exporter-otlp-proto-http* ]]; then
549
+ HAS_OTEL_EXPORTER_HTTP=true
550
+ fi
551
+ done
552
+
553
+ if [[ "$HAS_OTEL_API" == false ]]; then
554
+ UV_WITH_ARRAY+=("$OTEL_API_SPEC")
555
+ fi
556
+ if [[ "$HAS_OTEL_SDK" == false ]]; then
557
+ UV_WITH_ARRAY+=("$OTEL_SDK_SPEC")
558
+ fi
559
+ if [[ "$HAS_OTEL_EXPORTER_GRPC" == false ]]; then
560
+ UV_WITH_ARRAY+=("$OTEL_EXPORTER_OTLP_GRPC_SPEC")
561
+ fi
562
+ if [[ "$HAS_OTEL_EXPORTER_HTTP" == false ]]; then
563
+ UV_WITH_ARRAY+=("$OTEL_EXPORTER_OTLP_HTTP_SPEC")
564
+ fi
565
+ fi
566
+
567
+ if [[ "$AGENTOPS_SHOULD_INSTALL" == true ]]; then
568
+ AGENTOPS_SPEC="${LITELLM_AGENTOPS_SPEC:-agentops>=0.3.0}"
569
+ HAS_AGENTOPS_SPEC=false
570
+ for pkg in "${UV_WITH_ARRAY[@]}"; do
571
+ if [[ "$pkg" == agentops* ]]; then
572
+ HAS_AGENTOPS_SPEC=true
573
+ break
574
+ fi
575
+ done
576
+ if [[ "$HAS_AGENTOPS_SPEC" == false ]]; then
577
+ UV_WITH_ARRAY+=("$AGENTOPS_SPEC")
578
+ fi
579
+ fi
580
+
581
+ UV_WITH_DISPLAY="${UV_WITH_ARRAY[*]}"
582
+
583
+ # Enable logging of prompts and responses (INFO level to avoid streaming chunk noise)
584
+ export LITELLM_LOG="${LITELLM_LOG:-INFO}"
585
+ export PYTHONIOENCODING="${PYTHONIOENCODING:-utf-8}"
586
+ export PYTHONUTF8="${PYTHONUTF8:-1}"
587
+ export AGENT_HOME_DIR="${CHILD_AGENT_HOME_DIR}"
588
+ export LITELLM_CONFIG_PATH="${CHILD_CONFIG_PATH}"
589
+
590
+ # Add scripts directory to PYTHONPATH so custom hooks can be imported.
591
+ # Native Windows Python expects Windows-style paths and ';' separators.
592
+ CHILD_PYTHONPATH="${CHILD_SCRIPT_DIR}${CHILD_PATH_SEP}${CHILD_AGENT_HOME_DIR}"
593
+ if [[ -n "${PYTHONPATH:-}" ]]; then
594
+ CHILD_PYTHONPATH="${CHILD_PYTHONPATH}${CHILD_PATH_SEP}${PYTHONPATH}"
595
+ fi
596
+ export PYTHONPATH="${CHILD_PYTHONPATH}"
597
+
598
+ # When uv runs while a conda env is active, it can pick the conda interpreter
599
+ # instead of the resolved UV_PYTHON, leading to non-deterministic dependency resolution.
600
+ strip_conda_activation() {
601
+ local conda_vars=(
602
+ CONDA_DEFAULT_ENV
603
+ CONDA_EXE
604
+ CONDA_PREFIX
605
+ CONDA_PROMPT_MODIFIER
606
+ CONDA_PYTHON_EXE
607
+ CONDA_SHLVL
608
+ _CONDA_EXE
609
+ _CONDA_ROOT
610
+ __CONDA_OPENSLL_CERT_FILE_SET
611
+ _CE_CONDA
612
+ _CE_M
613
+ )
614
+ local had_conda=false
615
+ for name in "${conda_vars[@]}"; do
616
+ if [[ -n "${!name:-}" ]]; then
617
+ had_conda=true
618
+ unset "$name"
619
+ fi
620
+ done
621
+ if [[ "$had_conda" == true ]]; then
622
+ echo " env : cleared active conda variables for deterministic uv Python selection"
623
+ fi
624
+ }
625
+
626
+ strip_conda_activation
627
+
628
+ echo "Starting LiteLLM proxy on ${SCHEME}://${HOST}:${PORT}"
629
+ echo " config : ${CONFIG_PATH}"
630
+ echo " host : ${HOST}"
631
+ echo " port : ${PORT}"
632
+ echo " package: ${LITELLM_PACKAGE_SOURCE}"
633
+ echo " extras : ${EXTRA_ARGS[*]:-}"
634
+ echo " uv deps: ${UV_WITH_DISPLAY}"
635
+ if [[ "$TLS_ENABLED" == true ]]; then
636
+ echo " tls : enabled (${TLS_CERT})"
637
+ else
638
+ echo " tls : disabled (set LITELLM_ENABLE_TLS=true to enable)"
639
+ fi
640
+ echo " logging: ${LITELLM_LOG} (set LITELLM_LOG=INFO to reduce verbosity)"
641
+
642
+ UV_RUN_CMD=(uv run)
643
+ if [[ ${#UV_ARGS[@]} -gt 0 ]]; then
644
+ UV_RUN_CMD+=("${UV_ARGS[@]}")
645
+ fi
646
+ LITELLM_ARGS=(--host "${HOST}" --port "${PORT}" --config "${CHILD_CONFIG_PATH}")
647
+ if [[ "$TLS_ENABLED" == true ]]; then
648
+ LITELLM_ARGS+=(--ssl_certfile_path "${CHILD_TLS_CERT}" --ssl_keyfile_path "${CHILD_TLS_KEY}")
649
+ fi
650
+ for pkg in "${UV_WITH_ARRAY[@]}"; do
651
+ UV_RUN_CMD+=(--with "$pkg")
652
+ done
653
+ UV_RUN_CMD+=(-- litellm "${LITELLM_ARGS[@]}")
654
+
655
+ # Start LiteLLM in the background so we can write a PID file with metadata.
656
+ # Then wait on it to preserve foreground behavior.
657
+ mkdir -p "$SHELL_AGENT_HOME_DIR"
658
+ PID_FILE="${SHELL_AGENT_HOME_DIR}/litellm.pid"
659
+ PREEXISTING_LISTENER_PID="$(get_windows_listener_pid "${PORT}" || true)"
660
+
661
+ if [[ ${#EXTRA_ARGS[@]} -gt 0 ]]; then
662
+ "${UV_RUN_CMD[@]}" "${EXTRA_ARGS[@]}" &
663
+ else
664
+ "${UV_RUN_CMD[@]}" &
665
+ fi
666
+ LITELLM_PID=$!
667
+ PID_FILE_PID="$LITELLM_PID"
668
+ if [[ -f "/proc/${LITELLM_PID}/winpid" ]]; then
669
+ WINPID=$(tr -d "\r\n" < "/proc/${LITELLM_PID}/winpid")
670
+ if [[ -n "$WINPID" ]]; then
671
+ PID_FILE_PID="$WINPID"
672
+ fi
673
+
674
+ for _ in {1..10}; do
675
+ LISTENER_PID="$(get_windows_listener_pid "${PORT}" || true)"
676
+ if [[ -n "$LISTENER_PID" && "$LISTENER_PID" != "$PREEXISTING_LISTENER_PID" ]]; then
677
+ PID_FILE_PID="$LISTENER_PID"
678
+ break
679
+ fi
680
+ sleep 1
681
+ done
682
+ fi
683
+
684
+ PID_LINES=("${PID_FILE_PID}")
685
+ if [[ "$OTEL_SHOULD_INSTALL" == true ]] || [[ "$OTEL_CALLBACK_PRESENT" == true ]]; then
686
+ PID_LINES+=("otel")
687
+ fi
688
+ PID_LINES+=("url=${LITELLM_URL}")
689
+ PID_LINES+=("config=${CHILD_CONFIG_PATH}")
690
+ printf '%s\n' "${PID_LINES[@]}" > "$PID_FILE"
691
+
692
+ cleanup() {
693
+ kill -TERM "$LITELLM_PID" 2>/dev/null || true
694
+ }
695
+ trap cleanup INT TERM
696
+
697
+ wait "$LITELLM_PID"
698
+ EXIT_CODE=$?
699
+ rm -f "$PID_FILE" 2>/dev/null || true
700
+ exit "$EXIT_CODE"