@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.
- package/LICENSE +21 -0
- package/bin/agenthippo.js +2 -0
- package/out/agentpack/github.js +547 -0
- package/out/agentpack/index.js +66 -0
- package/out/agentpack/install.js +297 -0
- package/out/agentpack/manager.js +441 -0
- package/out/agentpack/manifest.js +135 -0
- package/out/agentpack/paths.js +475 -0
- package/out/agentpack/publish.js +248 -0
- package/out/agentpack/stores.js +554 -0
- package/out/agentpack/types.js +5 -0
- package/out/analytics/dashboard/artifactManager.js +439 -0
- package/out/analytics/dashboard/fleetDisplayUtils.js +159 -0
- package/out/analytics/dashboard/fleetOrchestrator.js +142 -0
- package/out/analytics/dashboard/fleetRegistry.js +79 -0
- package/out/analytics/dashboard/fleetRowDefaults.js +87 -0
- package/out/analytics/dashboard/fleetScriptAdapter.js +146 -0
- package/out/analytics/dashboard/fleetStatusUtils.js +30 -0
- package/out/analytics/dashboard/fleetTitleUtils.js +68 -0
- package/out/analytics/dashboard/fleetTypes.js +29 -0
- package/out/analytics/dashboard/index.js +17 -0
- package/out/analytics/dashboard/indexingService.js +422 -0
- package/out/analytics/dashboard/localFleetAdapter.js +222 -0
- package/out/analytics/dashboard/performanceMonitor.js +76 -0
- package/out/analytics/dashboard/processManager.js +209 -0
- package/out/analytics/dashboard/provider.js +3885 -0
- package/out/analytics/dashboard/queryRunner.js +994 -0
- package/out/analytics/dashboard/refreshPolicy.js +16 -0
- package/out/analytics/dashboard/scheduledFleetFingerprint.js +22 -0
- package/out/analytics/dashboard/scheduledFleetStorage.js +241 -0
- package/out/analytics/dashboard/scheduledFleetUtils.js +22 -0
- package/out/analytics/dashboard/sessionEventFleetStats.js +118 -0
- package/out/analytics/dashboard/sessionJsonlFleet.js +204 -0
- package/out/analytics/dashboard/teamViewDiscovery.js +106 -0
- package/out/analytics/dashboard/viewsConfigMerge.js +221 -0
- package/out/analytics/dashboard/webview/analytics-panel.html +155 -0
- package/out/analytics/dashboard/webview/codicon.ttf +0 -0
- package/out/analytics/dashboard/webview/index.html +78 -0
- package/out/analytics/dashboard/webview/panel.js +2295 -0
- package/out/analytics/dashboard/webview/runtime-bridge.js +82 -0
- package/out/analytics/dashboard/webview/styles.css +1009 -0
- package/out/analytics/lifecycle.js +43 -0
- package/out/analytics/service.js +1279 -0
- package/out/analytics/sessionEvents.js +231 -0
- package/out/auth/bootstrapApply.js +72 -0
- package/out/auth/brokerClient.js +126 -0
- package/out/auth/callbackUri.js +59 -0
- package/out/auth/callbackUriParse.js +59 -0
- package/out/auth/githubStoreGate.js +70 -0
- package/out/auth/loopbackAuthServer.js +165 -0
- package/out/auth/pkce.js +9 -0
- package/out/auth/provider.js +239 -0
- package/out/auth/sessionStore.js +193 -0
- package/out/auth/signInFlow.js +182 -0
- package/out/auth/types.js +12 -0
- package/out/auth-broker/config.js +62 -0
- package/out/auth-broker/jwt.js +105 -0
- package/out/auth-broker/pkce.js +57 -0
- package/out/auth-broker/server.js +539 -0
- package/out/auth-broker/store.js +273 -0
- package/out/base-prompts/gateway/openclaw-starter.json5 +144 -0
- package/out/base-prompts/gateway/slack-socket-mode-minimal.manifest.json +44 -0
- package/out/base-prompts/mcp-servers/.mcp.json +13 -0
- package/out/base-prompts/mcp-servers/langfuse-analytics/README.md +142 -0
- package/out/base-prompts/mcp-servers/langfuse-analytics/mcp.json +13 -0
- package/out/base-prompts/mcp-servers/langfuse-analytics/package-lock.json +1192 -0
- package/out/base-prompts/mcp-servers/langfuse-analytics/package.json +23 -0
- package/out/base-prompts/mcp-servers/langfuse-analytics/scripts/run-with-env.sh +12 -0
- package/out/base-prompts/mcp-servers/langfuse-analytics/scripts/sdk-test.js +102 -0
- package/out/base-prompts/mcp-servers/langfuse-analytics/scripts/simple-test.js +137 -0
- package/out/base-prompts/mcp-servers/langfuse-analytics/scripts/test-client.js +118 -0
- package/out/base-prompts/mcp-servers/langfuse-analytics/scripts/test-server.js +209 -0
- package/out/base-prompts/mcp-servers/langfuse-analytics/src/client.ts +431 -0
- package/out/base-prompts/mcp-servers/langfuse-analytics/src/index.ts +270 -0
- package/out/base-prompts/mcp-servers/langfuse-analytics/tsconfig.json +18 -0
- package/out/base-prompts/rules/AGENTS.md +204 -0
- package/out/base-prompts/skills/agent-browser/SKILL.md +102 -0
- package/out/base-prompts/skills/agent-builder/SKILL.md +73 -0
- package/out/base-prompts/skills/agent-builder/references/agent-pack.md +63 -0
- package/out/base-prompts/skills/agent-builder/references/crewai.md +66 -0
- package/out/base-prompts/skills/agent-builder/references/langchain.md +60 -0
- package/out/base-prompts/skills/agent-builder/references/raw-sdk.md +73 -0
- package/out/base-prompts/skills/agent-engine-creator/SKILL.md +586 -0
- package/out/base-prompts/skills/agent-engine-installer/SKILL.md +106 -0
- package/out/base-prompts/skills/agent-engine-installer/scripts/install-engine.mjs +259 -0
- package/out/base-prompts/skills/agent-engine-installer/scripts/install-engine.ps1 +189 -0
- package/out/base-prompts/skills/agenthippo-cli/SKILL.md +69 -0
- package/out/base-prompts/skills/agenthippo-cli/scripts/install.sh +63 -0
- package/out/base-prompts/skills/agentpack-creator/SKILL.md +375 -0
- package/out/base-prompts/skills/agentpack-creator/references/agent-templates.md +261 -0
- package/out/base-prompts/skills/agentpack-creator/references/agents-md-guide.md +195 -0
- package/out/base-prompts/skills/agentpack-creator/scripts/init_pack.py +391 -0
- package/out/base-prompts/skills/agentpack-creator/scripts/init_pack_test.py +294 -0
- package/out/base-prompts/skills/agentpack-testbench/SKILL.md +135 -0
- package/out/base-prompts/skills/algorithmic-art/LICENSE.txt +202 -0
- package/out/base-prompts/skills/algorithmic-art/SKILL.md +405 -0
- package/out/base-prompts/skills/algorithmic-art/templates/generator_template.js +223 -0
- package/out/base-prompts/skills/algorithmic-art/templates/viewer.html +599 -0
- package/out/base-prompts/skills/debug-agent/SKILL.md +83 -0
- package/out/base-prompts/skills/desktop-automation/SKILL.md +166 -0
- package/out/base-prompts/skills/desktop-automation/references/agenthippo-ui-recipes.md +441 -0
- package/out/base-prompts/skills/desktop-automation/scripts/windows-desktop-uia.psm1 +280 -0
- package/out/base-prompts/skills/docx/LICENSE.txt +30 -0
- package/out/base-prompts/skills/docx/SKILL.md +197 -0
- package/out/base-prompts/skills/docx/docx-js.md +350 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/mce/mc.xsd +75 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/out/base-prompts/skills/docx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/out/base-prompts/skills/docx/ooxml/scripts/pack.py +159 -0
- package/out/base-prompts/skills/docx/ooxml/scripts/unpack.py +29 -0
- package/out/base-prompts/skills/docx/ooxml/scripts/validate.py +69 -0
- package/out/base-prompts/skills/docx/ooxml/scripts/validation/__init__.py +15 -0
- package/out/base-prompts/skills/docx/ooxml/scripts/validation/base.py +951 -0
- package/out/base-prompts/skills/docx/ooxml/scripts/validation/docx.py +274 -0
- package/out/base-prompts/skills/docx/ooxml/scripts/validation/pptx.py +315 -0
- package/out/base-prompts/skills/docx/ooxml/scripts/validation/redlining.py +279 -0
- package/out/base-prompts/skills/docx/ooxml.md +610 -0
- package/out/base-prompts/skills/docx/scripts/__init__.py +1 -0
- package/out/base-prompts/skills/docx/scripts/document.py +1276 -0
- package/out/base-prompts/skills/docx/scripts/templates/comments.xml +3 -0
- package/out/base-prompts/skills/docx/scripts/templates/commentsExtended.xml +3 -0
- package/out/base-prompts/skills/docx/scripts/templates/commentsExtensible.xml +3 -0
- package/out/base-prompts/skills/docx/scripts/templates/commentsIds.xml +3 -0
- package/out/base-prompts/skills/docx/scripts/templates/people.xml +3 -0
- package/out/base-prompts/skills/docx/scripts/utilities.py +374 -0
- package/out/base-prompts/skills/gateway-outbound/SKILL.md +136 -0
- package/out/base-prompts/skills/mcp-builder/LICENSE.txt +202 -0
- package/out/base-prompts/skills/mcp-builder/SKILL.md +328 -0
- package/out/base-prompts/skills/mcp-builder/reference/evaluation.md +602 -0
- package/out/base-prompts/skills/mcp-builder/reference/mcp_best_practices.md +249 -0
- package/out/base-prompts/skills/mcp-builder/reference/node_mcp_server.md +970 -0
- package/out/base-prompts/skills/mcp-builder/reference/python_mcp_server.md +719 -0
- package/out/base-prompts/skills/mcp-builder/scripts/connections.py +151 -0
- package/out/base-prompts/skills/mcp-builder/scripts/evaluation.py +373 -0
- package/out/base-prompts/skills/mcp-builder/scripts/example_evaluation.xml +22 -0
- package/out/base-prompts/skills/mcp-builder/scripts/requirements.txt +2 -0
- package/out/base-prompts/skills/openclaw/SKILL.md +406 -0
- package/out/base-prompts/skills/openclaw/scripts/run-smoke.sh +61 -0
- package/out/base-prompts/skills/pdf/LICENSE.txt +30 -0
- package/out/base-prompts/skills/pdf/SKILL.md +294 -0
- package/out/base-prompts/skills/pdf/forms.md +205 -0
- package/out/base-prompts/skills/pdf/reference.md +612 -0
- package/out/base-prompts/skills/pdf/scripts/check_bounding_boxes.py +70 -0
- package/out/base-prompts/skills/pdf/scripts/check_bounding_boxes_test.py +226 -0
- package/out/base-prompts/skills/pdf/scripts/check_fillable_fields.py +12 -0
- package/out/base-prompts/skills/pdf/scripts/convert_pdf_to_images.py +35 -0
- package/out/base-prompts/skills/pdf/scripts/create_validation_image.py +41 -0
- package/out/base-prompts/skills/pdf/scripts/extract_form_field_info.py +152 -0
- package/out/base-prompts/skills/pdf/scripts/fill_fillable_fields.py +114 -0
- package/out/base-prompts/skills/pdf/scripts/fill_pdf_form_with_annotations.py +108 -0
- package/out/base-prompts/skills/pptx/LICENSE.txt +30 -0
- package/out/base-prompts/skills/pptx/SKILL.md +484 -0
- package/out/base-prompts/skills/pptx/html2pptx.md +625 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/mce/mc.xsd +75 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/out/base-prompts/skills/pptx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/out/base-prompts/skills/pptx/ooxml/scripts/pack.py +159 -0
- package/out/base-prompts/skills/pptx/ooxml/scripts/unpack.py +29 -0
- package/out/base-prompts/skills/pptx/ooxml/scripts/validate.py +69 -0
- package/out/base-prompts/skills/pptx/ooxml/scripts/validation/__init__.py +15 -0
- package/out/base-prompts/skills/pptx/ooxml/scripts/validation/base.py +951 -0
- package/out/base-prompts/skills/pptx/ooxml/scripts/validation/docx.py +274 -0
- package/out/base-prompts/skills/pptx/ooxml/scripts/validation/pptx.py +315 -0
- package/out/base-prompts/skills/pptx/ooxml/scripts/validation/redlining.py +279 -0
- package/out/base-prompts/skills/pptx/ooxml.md +427 -0
- package/out/base-prompts/skills/pptx/scripts/html2pptx.js +984 -0
- package/out/base-prompts/skills/pptx/scripts/inventory.py +1020 -0
- package/out/base-prompts/skills/pptx/scripts/rearrange.py +231 -0
- package/out/base-prompts/skills/pptx/scripts/replace.py +385 -0
- package/out/base-prompts/skills/pptx/scripts/thumbnail.py +450 -0
- package/out/base-prompts/skills/prompt-lab/SKILL.md +149 -0
- package/out/base-prompts/skills/prompt-lab/scripts/query-analytics.sh +2551 -0
- package/out/base-prompts/skills/skill-creator/LICENSE.txt +202 -0
- package/out/base-prompts/skills/skill-creator/SKILL.md +371 -0
- package/out/base-prompts/skills/skill-creator/references/output-patterns.md +82 -0
- package/out/base-prompts/skills/skill-creator/references/workflows.md +28 -0
- package/out/base-prompts/skills/skill-creator/scripts/init_skill.py +303 -0
- package/out/base-prompts/skills/skill-creator/scripts/package_skill.py +110 -0
- package/out/base-prompts/skills/skill-creator/scripts/quick_validate.py +95 -0
- package/out/base-prompts/skills/skill-installer/SKILL.md +251 -0
- package/out/base-prompts/skills/skill-installer/references/store-api.md +219 -0
- package/out/base-prompts/skills/spotlight-dashboard/SKILL.md +83 -0
- package/out/base-prompts/skills/spotlight-insights/SKILL.md +101 -0
- package/out/base-prompts/skills/spotlight-optimize/SKILL.md +93 -0
- package/out/base-prompts/skills/spotlight-optimize/scripts/query-analytics.sh +2551 -0
- package/out/base-prompts/skills/spotlight-query/SKILL.md +314 -0
- package/out/base-prompts/skills/spotlight-query/references/otel-schema.md +163 -0
- package/out/base-prompts/skills/spotlight-query/scripts/query-analytics.sh +2551 -0
- package/out/base-prompts/skills/spotlight-query/scripts/query-analytics.test.sh +744 -0
- package/out/base-prompts/skills/spotlight-query/scripts/test-fixtures/analytics/sessions/sess-test-1.jsonl +14 -0
- package/out/base-prompts/skills/spotlight-query/scripts/test-fixtures/analytics/traces/.duckdb-index.json +7 -0
- package/out/base-prompts/skills/spotlight-query/scripts/test-fixtures/analytics/traces/sample.jsonl +5 -0
- package/out/base-prompts/skills/spotlight-report/SKILL.md +86 -0
- package/out/base-prompts/skills/spotlight-visualize/SKILL.md +92 -0
- package/out/base-prompts/skills/spotlight-visualize/scripts/query-analytics.sh +2551 -0
- package/out/base-prompts/skills/xlsx/LICENSE.txt +30 -0
- package/out/base-prompts/skills/xlsx/SKILL.md +289 -0
- package/out/base-prompts/skills/xlsx/recalc.py +178 -0
- package/out/branding.js +23 -0
- package/out/cli/commands/anywhere.js +66 -0
- package/out/cli/commands/ask.js +243 -0
- package/out/cli/commands/auth-broker.js +24 -0
- package/out/cli/commands/auth.js +219 -0
- package/out/cli/commands/chat.js +354 -0
- package/out/cli/commands/deploy.js +223 -0
- package/out/cli/commands/gateway.js +160 -0
- package/out/cli/commands/pack.js +220 -0
- package/out/cli/commands/probe-custom-engine.js +82 -0
- package/out/cli/commands/serve.js +583 -0
- package/out/cli/commands/store.js +919 -0
- package/out/cli/credential-context.js +113 -0
- package/out/cli/deploy-init.js +2087 -0
- package/out/cli/deps.js +238 -0
- package/out/cli/index.js +390 -0
- package/out/cli/pack-loader.js +376 -0
- package/out/cli/run-custom-engine-runner.js +318 -0
- package/out/cli/runtime.js +409 -0
- package/out/cli/serve-hardening.js +325 -0
- package/out/cli/state-sync.js +135 -0
- package/out/cli/utils.js +220 -0
- package/out/cli/vscode-shim.js +86 -0
- package/out/engines/base.js +159 -0
- package/out/engines/claude.js +1215 -0
- package/out/engines/codex.js +759 -0
- package/out/engines/custom.js +632 -0
- package/out/engines/customEngineIpc.js +95 -0
- package/out/engines/customEngineRunnerEmbed.js +107 -0
- package/out/engines/customRegistry.js +274 -0
- package/out/engines/embeddedCustomEngineRunner.generated.js +9 -0
- package/out/engines/engineApiKey.js +138 -0
- package/out/engines/factory.js +45 -0
- package/out/engines/install.js +372 -0
- package/out/engines/persistentEngineWorker.js +320 -0
- package/out/engines/publish.js +341 -0
- package/out/engines/types.js +17 -0
- package/out/examples/run-headless-repl.js +291 -0
- package/out/examples/run-headless.js +187 -0
- package/out/extension.js +4472 -0
- package/out/gateway/bridge.js +805 -0
- package/out/gateway/cli-agent-id.js +36 -0
- package/out/gateway/client.js +303 -0
- package/out/gateway/client.test.js +395 -0
- package/out/gateway/gateway-scope-errors.js +14 -0
- package/out/gateway/gatewayBackup.js +76 -0
- package/out/gateway/gatewayRouteIndex.js +371 -0
- package/out/gateway/gatewaySessionStore.js +243 -0
- package/out/gateway/index.js +31 -0
- package/out/gateway/lifecycle.js +3056 -0
- package/out/gateway/openclaw-channel-routing.js +317 -0
- package/out/gateway/outboundHandles.js +373 -0
- package/out/gateway/outboundPaths.js +72 -0
- package/out/gateway/outboundSend.js +254 -0
- package/out/gateway/protocol.js +48 -0
- package/out/gateway/resetMappings.js +52 -0
- package/out/gateway/service.js +1244 -0
- package/out/gateway/sessionRouting.js +77 -0
- package/out/headless/index.js +505 -0
- package/out/headless/sync.js +473 -0
- package/out/mcp/publish.js +143 -0
- package/out/mcp.js +597 -0
- package/out/permissions.js +108 -0
- package/out/permissions.mapping.yaml +68 -0
- package/out/registry/index.js +332 -0
- package/out/remote/handleRemoteChat.js +122 -0
- package/out/remote/remotePackStatusBar.js +103 -0
- package/out/remote/serveClient.js +216 -0
- package/out/remoteSkills.js +191 -0
- package/out/runtime/index.js +32 -0
- package/out/runtime/interfaces/config-provider.js +32 -0
- package/out/runtime/interfaces/edit-tracker.js +22 -0
- package/out/runtime/interfaces/index.js +29 -0
- package/out/runtime/interfaces/logger.js +40 -0
- package/out/runtime/interfaces/permission-handler.js +66 -0
- package/out/runtime/interfaces/session-store.js +342 -0
- package/out/runtime/vscode/index.js +20 -0
- package/out/runtime/vscode/vscode-config-provider.js +77 -0
- package/out/runtime/vscode/vscode-edit-tracker.js +120 -0
- package/out/runtime/vscode/vscode-logger.js +30 -0
- package/out/runtime/vscode/vscode-permission-handler.js +72 -0
- package/out/runtime/vscode/vscode-session-store.js +22 -0
- package/out/scripts/agentide-litellm.ps1 +501 -0
- package/out/scripts/agentide-litellm.sh +700 -0
- package/out/scripts/agentide_litellm_hooks_v1.py +604 -0
- package/out/scripts/analytics/agent-fleet-widget.js +954 -0
- package/out/scripts/analytics/agentide-litellm-otel.config.yaml +160 -0
- package/out/scripts/analytics/default-seed-scripts.json +12 -0
- package/out/scripts/analytics/duckdbLocator.js +29 -0
- package/out/scripts/analytics/fleet-local-adapter.js +246 -0
- package/out/scripts/analytics/fleet-workflow.sh +263 -0
- package/out/scripts/analytics/generate-default-charts.py +685 -0
- package/out/scripts/analytics/hotspot-analysis-widget.js +909 -0
- package/out/scripts/analytics/index-traces.py +1394 -0
- package/out/scripts/analytics/install-analytics.sh +286 -0
- package/out/scripts/analytics/live-fleet-4-collector.cjs +315 -0
- package/out/scripts/analytics/live-fleet-4-daemon.mjs +134 -0
- package/out/scripts/analytics/live-fleet-4-widget.cjs +433 -0
- package/out/scripts/analytics/otel-collector.yaml +55 -0
- package/out/scripts/analytics/query-analytics.ps1 +396 -0
- package/out/scripts/analytics/query-analytics.sh +2551 -0
- package/out/scripts/analytics/session-comparison-widget.js +1468 -0
- package/out/scripts/analytics/session-timeline-widget.js +2137 -0
- package/out/scripts/analytics/setup-analytics.ps1 +432 -0
- package/out/scripts/analytics/setup-analytics.sh +854 -0
- package/out/scripts/analytics/start-analytics.ps1 +169 -0
- package/out/scripts/analytics/start-analytics.sh +323 -0
- package/out/scripts/analytics/token-cost-flamegraph-widget.js +954 -0
- package/out/scripts/analytics/token-cost-trend-widget.js +1062 -0
- package/out/scripts/analytics/workflows-collector.cjs +315 -0
- package/out/scripts/analytics/workflows-daemon.mjs +186 -0
- package/out/scripts/analytics/workflows-widget.cjs +433 -0
- package/out/scripts/analytics/wow-model-widget.js +191 -0
- package/out/scripts/gateway/Dockerfile.serve +45 -0
- package/out/scripts/gateway/docker-serve.sh +248 -0
- package/out/scripts/gateway/setup-gateway-server.ps1 +953 -0
- package/out/scripts/gateway/setup-gateway-server.sh +935 -0
- package/out/scripts/gateway/setup-gateway.ps1 +1813 -0
- package/out/scripts/gateway/setup-gateway.sh +1541 -0
- package/out/scripts/setup-cli.ps1 +86 -0
- package/out/scripts/setup-cli.sh +117 -0
- package/out/scripts/tools-manifest.json +83 -0
- package/out/scripts/vendor-tools.mjs +234 -0
- package/out/session.js +272 -0
- package/out/shared/agentEngines.js +170 -0
- package/out/shared/index.js +109 -0
- package/out/shared/models.js +235 -0
- package/out/shared/providers.js +202 -0
- package/out/skills/publish.js +178 -0
- package/out/spotlight/install.js +339 -0
- package/out/spotlight/publish.js +544 -0
- package/out/spotlight/yaml.js +31 -0
- package/out/store/github/setup.js +235 -0
- package/out/store/github/templates/build-index.ts +339 -0
- package/out/store/github/templates/build-index.yml +97 -0
- package/out/store/github/templates/package.json +11 -0
- package/out/store/index.js +755 -0
- package/out/store/oramaIndex.js +884 -0
- package/out/store/shared.js +241 -0
- package/out/sync.js +1827 -0
- package/out/terminalLogger.js +358 -0
- package/out/test/agentEnvFile.test.js +97 -0
- package/out/test/agentYaml.test.js +373 -0
- package/out/test/agentpack.test.js +639 -0
- package/out/test/analytics-lifecycle.test.js +174 -0
- package/out/test/analytics.test.js +524 -0
- package/out/test/auth-bootstrapApply.test.js +102 -0
- package/out/test/auth-broker.test.js +434 -0
- package/out/test/auth-callback.test.js +62 -0
- package/out/test/branding.test.js +229 -0
- package/out/test/cli-agent-id.test.js +55 -0
- package/out/test/credential-context.test.js +105 -0
- package/out/test/customEngineInstall.test.js +100 -0
- package/out/test/customRegistry.test.js +122 -0
- package/out/test/deploy-init.test.js +532 -0
- package/out/test/deps-auto-install.test.js +81 -0
- package/out/test/engine-integration.test.js +297 -0
- package/out/test/enginePaths.test.js +195 -0
- package/out/test/enginePublish.test.js +82 -0
- package/out/test/fleetDisplayUtils.test.js +96 -0
- package/out/test/gateway-client.test.js +381 -0
- package/out/test/gateway-lifecycle.test.js +608 -0
- package/out/test/gateway-outbound.test.js +531 -0
- package/out/test/gateway-reset-mappings.test.js +221 -0
- package/out/test/gateway-route-index.test.js +235 -0
- package/out/test/gateway-session-routing.test.js +47 -0
- package/out/test/gateway-session-store.test.js +216 -0
- package/out/test/github.test.js +232 -0
- package/out/test/headless-sync.test.js +279 -0
- package/out/test/helpers/manifest-fixtures.js +27 -0
- package/out/test/mcp-obo.test.js +82 -0
- package/out/test/mcp.test.js +307 -0
- package/out/test/openclaw-channel-routing.test.js +191 -0
- package/out/test/pathSafety.test.js +63 -0
- package/out/test/permissions.test.js +175 -0
- package/out/test/persistent-engine-worker.test.js +220 -0
- package/out/test/refreshPolicy.test.js +60 -0
- package/out/test/registry.test.js +351 -0
- package/out/test/runtime.test.js +349 -0
- package/out/test/scheduledFleetStorage.test.js +72 -0
- package/out/test/serve-hardening.test.js +192 -0
- package/out/test/serveClient.test.js +173 -0
- package/out/test/sessionJsonlFleet.test.js +78 -0
- package/out/test/shared.test.js +173 -0
- package/out/test/skills-mcp.test.js +299 -0
- package/out/test/spotlightPublish.test.js +299 -0
- package/out/test/spotlightYaml.test.js +58 -0
- package/out/test/state-sync-peer.test.js +74 -0
- package/out/test/store.test.js +331 -0
- package/out/test/stores.test.js +504 -0
- package/out/test/sync-switch.test.js +251 -0
- package/out/test/teamViewDiscovery.test.js +90 -0
- package/out/test/toolPath.test.js +120 -0
- package/out/test/utils.test.js +308 -0
- package/out/test/viewsConfigMerge.test.js +180 -0
- package/out/test/windows-command-line.test.js +75 -0
- package/out/utils/agentEnvFile.js +131 -0
- package/out/utils/binary.js +175 -0
- package/out/utils/index.js +37 -0
- package/out/utils/network.js +74 -0
- package/out/utils/pathSafety.js +60 -0
- package/out/utils/paths.js +116 -0
- package/out/utils/pid.js +180 -0
- package/out/utils/pythonRunner.js +258 -0
- package/out/utils/resolveNodeBinary.js +168 -0
- package/out/utils/toolPath.js +83 -0
- package/out/utils/windowsCommandLine.js +29 -0
- package/out/utils.js +915 -0
- package/out/workspaceFolders.js +59 -0
- package/package.json +41 -0
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) AgentHippo.ai. All rights reserved.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.TurnLimiter = exports.RateLimiter = exports.CONTAINER_SERVE_HOST = exports.SERVE_HOST_ENV = exports.DEFAULT_BIND_HOST = exports.DEFAULT_MAX_BODY_BYTES = void 0;
|
|
40
|
+
exports.resolveStateDir = resolveStateDir;
|
|
41
|
+
exports.resolveBindHost = resolveBindHost;
|
|
42
|
+
exports.clientIp = clientIp;
|
|
43
|
+
exports.resolveUserId = resolveUserId;
|
|
44
|
+
exports.resolveDataToken = resolveDataToken;
|
|
45
|
+
exports.peerToUserId = peerToUserId;
|
|
46
|
+
exports.corsHeaders = corsHeaders;
|
|
47
|
+
exports.readBodyWithCap = readBodyWithCap;
|
|
48
|
+
/**
|
|
49
|
+
* Serve helpers: state-dir resolution, identity header reading, CORS, turn limiting, body cap.
|
|
50
|
+
*
|
|
51
|
+
* Auth and credential checking are the deploy layer's responsibility (Caddy, Cloud Run IAP,
|
|
52
|
+
* Databricks Apps SSO, etc.). Serve trusts the identity headers set by the layer in front;
|
|
53
|
+
* it does not validate tokens or enforce bearer keys itself.
|
|
54
|
+
*
|
|
55
|
+
* SECURITY CONTRACT: serve trusts the identity and data-token headers below unconditionally.
|
|
56
|
+
* It MUST sit behind a proxy that (a) authenticates the caller and sets the identity header,
|
|
57
|
+
* and (b) STRIPS any client-supplied copies of these headers on the way in.
|
|
58
|
+
*/
|
|
59
|
+
const os = __importStar(require("os"));
|
|
60
|
+
const path = __importStar(require("path"));
|
|
61
|
+
/** Default cap on a single request body (1 MiB). Chat messages are small; large bodies are abuse or bugs. */
|
|
62
|
+
exports.DEFAULT_MAX_BODY_BYTES = 1024 * 1024;
|
|
63
|
+
/**
|
|
64
|
+
* Resolve where session state is persisted. Precedence:
|
|
65
|
+
* 1. explicit --state-dir
|
|
66
|
+
* 2. AGENTHIPPO_HOME (the documented container mount point)
|
|
67
|
+
* 3. tmpdir (dev/local only; lost on restart)
|
|
68
|
+
*
|
|
69
|
+
* Returns `{ dir, ephemeral }` so the caller can warn when ephemeral state is
|
|
70
|
+
* detected in a long-lived deployment.
|
|
71
|
+
*/
|
|
72
|
+
function resolveStateDir(stateDirOpt, env = process.env) {
|
|
73
|
+
const explicit = stateDirOpt?.trim();
|
|
74
|
+
if (explicit) {
|
|
75
|
+
return { dir: path.resolve(explicit), ephemeral: false };
|
|
76
|
+
}
|
|
77
|
+
const home = env.AGENTHIPPO_HOME?.trim() || env.AGENTIDE_HOME?.trim();
|
|
78
|
+
if (home) {
|
|
79
|
+
return { dir: path.join(path.resolve(home), 'serve-state'), ephemeral: false };
|
|
80
|
+
}
|
|
81
|
+
return { dir: path.join(os.tmpdir(), 'agenthippo-server'), ephemeral: true };
|
|
82
|
+
}
|
|
83
|
+
/** Loopback default — safe everywhere a human runs `serve` locally. */
|
|
84
|
+
exports.DEFAULT_BIND_HOST = '127.0.0.1';
|
|
85
|
+
/** Env var for the listen address (used by generated deploy Dockerfiles). */
|
|
86
|
+
exports.SERVE_HOST_ENV = 'AGENTHIPPO_SERVE_HOST';
|
|
87
|
+
/** Bind address baked into container deploy artifacts (Docker / Cloud Run sidecars). */
|
|
88
|
+
exports.CONTAINER_SERVE_HOST = '0.0.0.0';
|
|
89
|
+
/**
|
|
90
|
+
* Resolve the listen address. Precedence: explicit `--host` → AGENTHIPPO_SERVE_HOST → 127.0.0.1.
|
|
91
|
+
*
|
|
92
|
+
* Defaults to loopback so a local `serve` is never reachable off-box by accident. Containers
|
|
93
|
+
* (where the SSO proxy reaches the agent over a Docker network) MUST opt into `0.0.0.0` —
|
|
94
|
+
* generated deploy artifacts set `AGENTHIPPO_SERVE_HOST=0.0.0.0` for exactly this reason.
|
|
95
|
+
*/
|
|
96
|
+
function resolveBindHost(hostOpt, env = process.env) {
|
|
97
|
+
return hostOpt?.trim() || env.AGENTHIPPO_SERVE_HOST?.trim() || exports.DEFAULT_BIND_HOST;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Best-effort client IP for rate-limiting keys.
|
|
101
|
+
*
|
|
102
|
+
* Behind the documented single trusted proxy (Caddy), `X-Forwarded-For` ends with the IP the
|
|
103
|
+
* proxy observed, so the right-most entry is the real client (a client-spoofed left-most entry
|
|
104
|
+
* is just prepended). Falls back to the socket address for direct/local callers. This is a
|
|
105
|
+
* coarse abuse key, not an identity — never use it for authorization.
|
|
106
|
+
*/
|
|
107
|
+
function clientIp(req) {
|
|
108
|
+
const xff = req.headers['x-forwarded-for'];
|
|
109
|
+
const raw = Array.isArray(xff) ? xff[0] : xff;
|
|
110
|
+
if (raw) {
|
|
111
|
+
const parts = raw.split(',').map((s) => s.trim()).filter(Boolean);
|
|
112
|
+
if (parts.length > 0) {
|
|
113
|
+
return parts[parts.length - 1];
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return req.socket?.remoteAddress || 'unknown';
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Fixed-window request rate limiter (per key, in-memory, per-process). Complements the
|
|
120
|
+
* per-session TurnLimiter: keying on a stable identity (user id, or client IP) closes the
|
|
121
|
+
* "rotate session_id to bypass" gap. `maxPerWindow <= 0` disables it.
|
|
122
|
+
*/
|
|
123
|
+
class RateLimiter {
|
|
124
|
+
maxPerWindow;
|
|
125
|
+
windowMs;
|
|
126
|
+
hits = new Map();
|
|
127
|
+
/** Cap the key map so a flood of distinct keys can't grow memory unbounded. */
|
|
128
|
+
static MAX_KEYS = 100_000;
|
|
129
|
+
constructor(maxPerWindow, windowMs = 60_000) {
|
|
130
|
+
this.maxPerWindow = maxPerWindow;
|
|
131
|
+
this.windowMs = windowMs;
|
|
132
|
+
}
|
|
133
|
+
/** Returns true if the request is allowed (and records it); false when the window cap is hit. */
|
|
134
|
+
tryConsume(key, now = Date.now()) {
|
|
135
|
+
if (!Number.isFinite(this.maxPerWindow) || this.maxPerWindow <= 0) {
|
|
136
|
+
return true; // disabled
|
|
137
|
+
}
|
|
138
|
+
const entry = this.hits.get(key);
|
|
139
|
+
if (!entry || entry.resetAt <= now) {
|
|
140
|
+
if (this.hits.size >= RateLimiter.MAX_KEYS) {
|
|
141
|
+
this.prune(now);
|
|
142
|
+
}
|
|
143
|
+
this.hits.set(key, { count: 1, resetAt: now + this.windowMs });
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
if (entry.count >= this.maxPerWindow) {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
entry.count += 1;
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
/** Seconds until the key's window resets — for a Retry-After header. */
|
|
153
|
+
retryAfterSeconds(key, now = Date.now()) {
|
|
154
|
+
const entry = this.hits.get(key);
|
|
155
|
+
if (!entry) {
|
|
156
|
+
return Math.ceil(this.windowMs / 1000);
|
|
157
|
+
}
|
|
158
|
+
return Math.max(1, Math.ceil((entry.resetAt - now) / 1000));
|
|
159
|
+
}
|
|
160
|
+
prune(now) {
|
|
161
|
+
for (const [key, entry] of this.hits) {
|
|
162
|
+
if (entry.resetAt <= now) {
|
|
163
|
+
this.hits.delete(key);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if (this.hits.size >= RateLimiter.MAX_KEYS) {
|
|
167
|
+
this.hits.clear();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
exports.RateLimiter = RateLimiter;
|
|
172
|
+
const HEADER_ALIASES = [
|
|
173
|
+
'x-agent-user', // AgentHippo canonical (set by our Worker / generic proxy)
|
|
174
|
+
'x-forwarded-email', // Databricks Apps
|
|
175
|
+
'x-forwarded-preferred-username', // Databricks Apps
|
|
176
|
+
'x-goog-authenticated-user-email', // Cloud Run IAP (prefixed value, stripped below)
|
|
177
|
+
'cf-access-authenticated-user-email', // Cloudflare Access
|
|
178
|
+
];
|
|
179
|
+
/**
|
|
180
|
+
* Resolve the end-user identity for a request.
|
|
181
|
+
*
|
|
182
|
+
* Proxy headers win over the request body — the header is set by the SSO proxy
|
|
183
|
+
* serve sits behind; the body is client-controlled. Falls back to body.user_id
|
|
184
|
+
* for dev/internal use (e.g. direct curl against a local serve).
|
|
185
|
+
*
|
|
186
|
+
* Resolves identity for `analyticsUserId` attribution and the request-scoped
|
|
187
|
+
* credential context (per-user data scoping). Not folded into the session key —
|
|
188
|
+
* session continuity uses the client-supplied `session_id`.
|
|
189
|
+
*
|
|
190
|
+
* Per-turn *data credentials* (OBO token, e.g. X-Forwarded-Access-Token) are
|
|
191
|
+
* handled by resolveDataToken — not read here.
|
|
192
|
+
*/
|
|
193
|
+
function resolveUserId(headers, body) {
|
|
194
|
+
for (const name of HEADER_ALIASES) {
|
|
195
|
+
const v = headers[name];
|
|
196
|
+
const raw = (Array.isArray(v) ? v[0] : v)?.trim();
|
|
197
|
+
if (raw) {
|
|
198
|
+
// IAP sends "accounts.google.com:user@x.com"; keep the email half.
|
|
199
|
+
const colon = raw.lastIndexOf(':');
|
|
200
|
+
const value = colon >= 0 && raw.slice(colon + 1).includes('@') ? raw.slice(colon + 1) : raw;
|
|
201
|
+
return value;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
const fromBody = body?.user_id?.trim();
|
|
205
|
+
return fromBody || undefined;
|
|
206
|
+
}
|
|
207
|
+
const DATA_TOKEN_HEADERS = [
|
|
208
|
+
'x-forwarded-access-token', // Databricks Apps OBO token
|
|
209
|
+
'x-agent-data-token', // AgentHippo generic per-turn data credential
|
|
210
|
+
];
|
|
211
|
+
/**
|
|
212
|
+
* Resolve the per-turn *data* credential (the OBO token), distinct from the
|
|
213
|
+
* identity in resolveUserId. Fed into the request-scoped credential context so
|
|
214
|
+
* a data tool can act as the asking user. serve-v3 §11.1 (Design B).
|
|
215
|
+
*
|
|
216
|
+
* Like the identity headers, this is trusted unconditionally and is only safe
|
|
217
|
+
* behind a proxy that strips client-supplied copies (see the module SECURITY
|
|
218
|
+
* CONTRACT above).
|
|
219
|
+
*/
|
|
220
|
+
function resolveDataToken(headers) {
|
|
221
|
+
for (const name of DATA_TOKEN_HEADERS) {
|
|
222
|
+
const v = headers[name];
|
|
223
|
+
const raw = (Array.isArray(v) ? v[0] : v)?.trim();
|
|
224
|
+
if (raw) {
|
|
225
|
+
return raw;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return undefined;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Map a gateway channel sender (PeerInfo) to a stable `user_id` (serve-v3 §11 / #4).
|
|
232
|
+
* Prefers the stable channel id, namespaced by channel, so the Slack/Telegram
|
|
233
|
+
* sender becomes the user_id that drives per-user attribution and data scoping —
|
|
234
|
+
* extending the per-user-permission wedge to channel surfaces.
|
|
235
|
+
*/
|
|
236
|
+
function peerToUserId(peer) {
|
|
237
|
+
if (!peer) {
|
|
238
|
+
return undefined;
|
|
239
|
+
}
|
|
240
|
+
const id = peer.senderId?.trim() || peer.senderUsername?.trim() || peer.senderName?.trim();
|
|
241
|
+
if (!id) {
|
|
242
|
+
return undefined;
|
|
243
|
+
}
|
|
244
|
+
const channel = peer.channel?.trim();
|
|
245
|
+
return channel ? `${channel}:${id}` : id;
|
|
246
|
+
}
|
|
247
|
+
/** Build CORS headers. Serve is always behind a proxy; CORS is wide-open here. */
|
|
248
|
+
function corsHeaders() {
|
|
249
|
+
return {
|
|
250
|
+
'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
|
|
251
|
+
'Access-Control-Allow-Headers': 'Content-Type, Authorization, X-Agent-User',
|
|
252
|
+
'Access-Control-Allow-Origin': '*',
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Per-session turn admission control. Caps the number of turns a single
|
|
257
|
+
* conversation may run (abuse / runaway-loop guard for exposed deployments).
|
|
258
|
+
* In-memory and per-process — sufficient for single-container tiers; a shared
|
|
259
|
+
* store is a later concern.
|
|
260
|
+
*/
|
|
261
|
+
class TurnLimiter {
|
|
262
|
+
maxPerSession;
|
|
263
|
+
counts = new Map();
|
|
264
|
+
constructor(maxPerSession) {
|
|
265
|
+
this.maxPerSession = maxPerSession;
|
|
266
|
+
}
|
|
267
|
+
/** Returns true if the turn is allowed (and records it); false when the cap is exceeded. */
|
|
268
|
+
tryConsume(sessionKey) {
|
|
269
|
+
if (!Number.isFinite(this.maxPerSession) || this.maxPerSession <= 0) {
|
|
270
|
+
return true; // disabled
|
|
271
|
+
}
|
|
272
|
+
const current = this.counts.get(sessionKey) ?? 0;
|
|
273
|
+
if (current >= this.maxPerSession) {
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
this.counts.set(sessionKey, current + 1);
|
|
277
|
+
return true;
|
|
278
|
+
}
|
|
279
|
+
reset(sessionKey) {
|
|
280
|
+
this.counts.delete(sessionKey);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
exports.TurnLimiter = TurnLimiter;
|
|
284
|
+
/**
|
|
285
|
+
* Read a request body with a hard size cap. Past the cap it stops accumulating
|
|
286
|
+
* and rejects with a `tooLarge`-tagged error so the caller can respond 413.
|
|
287
|
+
*
|
|
288
|
+
* Deliberately does NOT destroy the socket here: destroying mid-upload resets
|
|
289
|
+
* the connection before the 413 can flush (the client only ever sees the
|
|
290
|
+
* interim 100-continue). We detach our listeners and let the handler send 413
|
|
291
|
+
* with `Connection: close`. Replaces serve's unbounded body accumulation.
|
|
292
|
+
*/
|
|
293
|
+
function readBodyWithCap(req, maxBytes = exports.DEFAULT_MAX_BODY_BYTES) {
|
|
294
|
+
return new Promise((resolve, reject) => {
|
|
295
|
+
let size = 0;
|
|
296
|
+
const chunks = [];
|
|
297
|
+
const onData = (chunk) => {
|
|
298
|
+
size += chunk.length;
|
|
299
|
+
if (size > maxBytes) {
|
|
300
|
+
cleanup();
|
|
301
|
+
const err = new Error(`Request body exceeds ${maxBytes} bytes`);
|
|
302
|
+
err.tooLarge = true;
|
|
303
|
+
reject(err);
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
chunks.push(chunk);
|
|
307
|
+
};
|
|
308
|
+
const onEnd = () => {
|
|
309
|
+
cleanup();
|
|
310
|
+
resolve(Buffer.concat(chunks).toString('utf8'));
|
|
311
|
+
};
|
|
312
|
+
const onError = (err) => {
|
|
313
|
+
cleanup();
|
|
314
|
+
reject(err);
|
|
315
|
+
};
|
|
316
|
+
const cleanup = () => {
|
|
317
|
+
req.off('data', onData);
|
|
318
|
+
req.off('end', onEnd);
|
|
319
|
+
req.off('error', onError);
|
|
320
|
+
};
|
|
321
|
+
req.on('data', onData);
|
|
322
|
+
req.on('end', onEnd);
|
|
323
|
+
req.on('error', onError);
|
|
324
|
+
});
|
|
325
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) AgentHippo.ai. All rights reserved.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isAwsCliAvailable = isAwsCliAvailable;
|
|
7
|
+
exports.resolveS3StateConfig = resolveS3StateConfig;
|
|
8
|
+
exports.restoreState = restoreState;
|
|
9
|
+
exports.pushState = pushState;
|
|
10
|
+
exports.makeStatePusher = makeStatePusher;
|
|
11
|
+
/**
|
|
12
|
+
* Object-store state sync (serve-v3 Q1, shared SessionStore).
|
|
13
|
+
*
|
|
14
|
+
* Persists the durable state root (/state) to an S3-compatible object store so
|
|
15
|
+
* sessions survive scale-to-zero / a fresh instance even where there is NO
|
|
16
|
+
* filesystem mount (Cloudflare R2, Databricks → S3/DBFS), and so a sticky-routed
|
|
17
|
+
* fleet replica can reload an affinity-owned session.
|
|
18
|
+
*
|
|
19
|
+
* Strategy (agreed): boot restore + per-turn async-delta push (debounced, off
|
|
20
|
+
* the response path) + a SIGTERM flush. Uses `aws s3 sync` (delta by default;
|
|
21
|
+
* S3-compatible via --endpoint-url → MinIO / R2 / GCS / S3) so we add no SDK to
|
|
22
|
+
* the binary. Single-writer-per-session safety comes from sticky-by-session_id.
|
|
23
|
+
*
|
|
24
|
+
* Config (no-op unless AGENTHIPPO_STATE_S3_URI is set):
|
|
25
|
+
* AGENTHIPPO_STATE_S3_URI s3://bucket/prefix
|
|
26
|
+
* AGENTHIPPO_STATE_S3_ENDPOINT http://minio:9000 (for non-AWS S3)
|
|
27
|
+
* AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY / AWS_REGION (standard aws creds)
|
|
28
|
+
*/
|
|
29
|
+
const child_process_1 = require("child_process");
|
|
30
|
+
const util_1 = require("util");
|
|
31
|
+
const execFileAsync = (0, util_1.promisify)(child_process_1.execFile);
|
|
32
|
+
/**
|
|
33
|
+
* Verify the `aws` CLI is callable. State sync shells out to it, so when S3 is
|
|
34
|
+
* configured a missing binary means silent data loss — callers should fail fast.
|
|
35
|
+
* Resolves true when available, false otherwise.
|
|
36
|
+
*/
|
|
37
|
+
async function isAwsCliAvailable() {
|
|
38
|
+
try {
|
|
39
|
+
await execFileAsync('aws', ['--version']);
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/** Returns the config when AGENTHIPPO_STATE_S3_URI is set, else null (sync disabled). */
|
|
47
|
+
function resolveS3StateConfig(env = process.env) {
|
|
48
|
+
const uri = env.AGENTHIPPO_STATE_S3_URI?.trim();
|
|
49
|
+
if (!uri) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
uri: uri.replace(/\/+$/, ''),
|
|
54
|
+
endpoint: env.AGENTHIPPO_STATE_S3_ENDPOINT?.trim() || undefined,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function syncArgs(cfg, from, to) {
|
|
58
|
+
const args = ['s3', 'sync', from, to, '--no-progress'];
|
|
59
|
+
if (cfg.endpoint) {
|
|
60
|
+
args.push('--endpoint-url', cfg.endpoint);
|
|
61
|
+
}
|
|
62
|
+
return args;
|
|
63
|
+
}
|
|
64
|
+
/** Download state from the bucket into stateDir on boot. An empty bucket is a no-op. */
|
|
65
|
+
async function restoreState(cfg, stateDir, log) {
|
|
66
|
+
try {
|
|
67
|
+
await execFileAsync('aws', syncArgs(cfg, cfg.uri, stateDir));
|
|
68
|
+
log?.(`State restored from ${cfg.uri}`);
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
// First boot / empty bucket / transient — don't block startup.
|
|
72
|
+
log?.(`State restore skipped: ${err instanceof Error ? err.message : String(err)}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/** Upload changed files from stateDir to the bucket (delta). */
|
|
76
|
+
async function pushState(cfg, stateDir, log) {
|
|
77
|
+
try {
|
|
78
|
+
await execFileAsync('aws', syncArgs(cfg, stateDir, cfg.uri));
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
// A failed push means sessions aren't durable — surface it unconditionally,
|
|
82
|
+
// not just under --verbose, so the operator notices state isn't persisting.
|
|
83
|
+
console.error(`[state-sync] push to ${cfg.uri} failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
84
|
+
log?.(`State push failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Debounced, non-overlapping pusher. `schedule()` after each turn (cheap, off the
|
|
89
|
+
* response path); coalesces bursts; `flush()` awaits a final push (SIGTERM).
|
|
90
|
+
*/
|
|
91
|
+
function makeStatePusher(cfg, stateDir, log, waitMs = 1000) {
|
|
92
|
+
let timer = null;
|
|
93
|
+
let running = false;
|
|
94
|
+
let pending = false;
|
|
95
|
+
let inflightPromise = null;
|
|
96
|
+
const runNow = () => {
|
|
97
|
+
running = true;
|
|
98
|
+
pending = false;
|
|
99
|
+
inflightPromise = pushState(cfg, stateDir, log).then(() => {
|
|
100
|
+
running = false;
|
|
101
|
+
inflightPromise = null;
|
|
102
|
+
if (pending) {
|
|
103
|
+
schedule();
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
return inflightPromise;
|
|
107
|
+
};
|
|
108
|
+
const schedule = () => {
|
|
109
|
+
if (running) {
|
|
110
|
+
pending = true;
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (timer) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
timer = setTimeout(() => {
|
|
117
|
+
timer = null;
|
|
118
|
+
void runNow();
|
|
119
|
+
}, waitMs);
|
|
120
|
+
timer.unref?.();
|
|
121
|
+
};
|
|
122
|
+
const flush = async () => {
|
|
123
|
+
if (timer) {
|
|
124
|
+
clearTimeout(timer);
|
|
125
|
+
timer = null;
|
|
126
|
+
}
|
|
127
|
+
// Wait for any in-flight push to complete before the final push,
|
|
128
|
+
// so SIGTERM never runs two concurrent aws s3 sync processes.
|
|
129
|
+
if (inflightPromise) {
|
|
130
|
+
await inflightPromise;
|
|
131
|
+
}
|
|
132
|
+
await pushState(cfg, stateDir, log);
|
|
133
|
+
};
|
|
134
|
+
return { schedule, flush };
|
|
135
|
+
}
|
package/out/cli/utils.js
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) AgentHippo.ai. All rights reserved.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.SUGGESTED_LITELLM_SMOKE_TEST_COMMAND = exports.COLORS = void 0;
|
|
40
|
+
exports.getBinaryDir = getBinaryDir;
|
|
41
|
+
exports.findClaudeCodePath = findClaudeCodePath;
|
|
42
|
+
exports.findCodexPath = findCodexPath;
|
|
43
|
+
exports.findBundledBasePromptsDir = findBundledBasePromptsDir;
|
|
44
|
+
exports.getLiteLLMQuickstartHintLines = getLiteLLMQuickstartHintLines;
|
|
45
|
+
/**
|
|
46
|
+
* CLI Utilities
|
|
47
|
+
*/
|
|
48
|
+
const os = __importStar(require("os"));
|
|
49
|
+
const path = __importStar(require("path"));
|
|
50
|
+
const fs = __importStar(require("fs"));
|
|
51
|
+
const child_process_1 = require("child_process");
|
|
52
|
+
const deps_1 = require("./deps");
|
|
53
|
+
/**
|
|
54
|
+
* Get the directory where the CLI binary is located.
|
|
55
|
+
* This is used to find bundled SDK assets.
|
|
56
|
+
*/
|
|
57
|
+
function getBinaryDir() {
|
|
58
|
+
// process.execPath is the path to the running binary
|
|
59
|
+
return path.dirname(process.execPath);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Find the Claude Code CLI executable path.
|
|
63
|
+
* Priority:
|
|
64
|
+
* 1. CLAUDE_CODE_PATH env
|
|
65
|
+
* 2. Installed via deps.ts (npm install on first run)
|
|
66
|
+
* 3. Bundled with binary (dist/claude-sdk/cli.js) - legacy
|
|
67
|
+
* 4. System 'claude' command
|
|
68
|
+
* 5. Common install locations
|
|
69
|
+
*/
|
|
70
|
+
function findClaudeCodePath() {
|
|
71
|
+
// 1. Check environment variable
|
|
72
|
+
if (process.env.CLAUDE_CODE_PATH) {
|
|
73
|
+
return process.env.CLAUDE_CODE_PATH;
|
|
74
|
+
}
|
|
75
|
+
// 2. Check npm-installed location (.agenthippo-deps/node_modules)
|
|
76
|
+
const depsPath = (0, deps_1.getClaudeSdkCliPath)();
|
|
77
|
+
if (depsPath) {
|
|
78
|
+
return depsPath;
|
|
79
|
+
}
|
|
80
|
+
// 3. Check bundled location (next to binary) - legacy fallback
|
|
81
|
+
const binaryDir = getBinaryDir();
|
|
82
|
+
const bundledPath = path.join(binaryDir, 'claude-sdk', 'cli.js');
|
|
83
|
+
try {
|
|
84
|
+
fs.accessSync(bundledPath, fs.constants.R_OK);
|
|
85
|
+
return bundledPath;
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
// Not bundled
|
|
89
|
+
}
|
|
90
|
+
// 4. Try 'which claude' (Unix) or 'where claude' (Windows)
|
|
91
|
+
try {
|
|
92
|
+
const cmd = process.platform === 'win32' ? 'where claude' : 'which claude';
|
|
93
|
+
const result = (0, child_process_1.execSync)(cmd, { encoding: 'utf8', stdio: ['pipe', 'pipe', 'ignore'] }).trim();
|
|
94
|
+
if (result) {
|
|
95
|
+
return result.split('\n')[0]; // First match
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
// Not found
|
|
100
|
+
}
|
|
101
|
+
// 5. Check common locations
|
|
102
|
+
const homeDir = os.homedir();
|
|
103
|
+
const commonPaths = [
|
|
104
|
+
path.join(homeDir, '.npm-global', 'bin', 'claude'),
|
|
105
|
+
path.join(homeDir, '.local', 'bin', 'claude'),
|
|
106
|
+
'/usr/local/bin/claude',
|
|
107
|
+
'/opt/homebrew/bin/claude',
|
|
108
|
+
];
|
|
109
|
+
for (const p of commonPaths) {
|
|
110
|
+
try {
|
|
111
|
+
fs.accessSync(p, fs.constants.X_OK);
|
|
112
|
+
return p;
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
// Not found or not executable
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Find the Codex CLI executable path.
|
|
122
|
+
* Priority:
|
|
123
|
+
* 1. CODEX_PATH env
|
|
124
|
+
* 2. Installed via deps.ts (@openai/codex/bin/codex.js on first run)
|
|
125
|
+
* 3. Bundled with binary (dist/codex-sdk/codex) - legacy native bundle
|
|
126
|
+
* 4. System 'codex' command
|
|
127
|
+
*/
|
|
128
|
+
function findCodexPath() {
|
|
129
|
+
// 1. Check environment variable
|
|
130
|
+
if (process.env.CODEX_PATH) {
|
|
131
|
+
return process.env.CODEX_PATH;
|
|
132
|
+
}
|
|
133
|
+
// 2. Check npm-installed location (.agenthippo-deps/node_modules)
|
|
134
|
+
const depsPath = (0, deps_1.getCodexSdkBinaryPath)();
|
|
135
|
+
if (depsPath) {
|
|
136
|
+
return depsPath;
|
|
137
|
+
}
|
|
138
|
+
// 3. Check bundled location (next to binary) - legacy fallback
|
|
139
|
+
const binaryDir = getBinaryDir();
|
|
140
|
+
const binaryName = process.platform === 'win32' ? 'codex.exe' : 'codex';
|
|
141
|
+
const bundledPath = path.join(binaryDir, 'codex-sdk', binaryName);
|
|
142
|
+
try {
|
|
143
|
+
fs.accessSync(bundledPath, fs.constants.X_OK);
|
|
144
|
+
return bundledPath;
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
// Not bundled
|
|
148
|
+
}
|
|
149
|
+
// 4. Try 'which codex' (Unix) or 'where codex' (Windows)
|
|
150
|
+
try {
|
|
151
|
+
const cmd = process.platform === 'win32' ? 'where codex' : 'which codex';
|
|
152
|
+
const result = (0, child_process_1.execSync)(cmd, { encoding: 'utf8', stdio: ['pipe', 'pipe', 'ignore'] }).trim();
|
|
153
|
+
if (result) {
|
|
154
|
+
return result.split('\n')[0];
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
// Not found
|
|
159
|
+
}
|
|
160
|
+
return undefined;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Find the bundled base-prompts directory.
|
|
164
|
+
* Priority:
|
|
165
|
+
* 1. AGENTHIPPO_BASE_PROMPTS_DIR env
|
|
166
|
+
* 2. Next to binary (dist/base-prompts)
|
|
167
|
+
* 3. Development location (relative to compiled out/)
|
|
168
|
+
*/
|
|
169
|
+
function findBundledBasePromptsDir() {
|
|
170
|
+
// 1. Check environment variable
|
|
171
|
+
const envPath = process.env.AGENTHIPPO_BASE_PROMPTS_DIR || process.env.AGENTIDE_BASE_PROMPTS_DIR;
|
|
172
|
+
if (envPath) {
|
|
173
|
+
try {
|
|
174
|
+
fs.accessSync(envPath, fs.constants.R_OK);
|
|
175
|
+
return envPath;
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
// Not found
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
// 2. Check bundled location (next to binary)
|
|
182
|
+
const binaryDir = getBinaryDir();
|
|
183
|
+
const bundledPath = path.join(binaryDir, 'base-prompts');
|
|
184
|
+
try {
|
|
185
|
+
fs.accessSync(bundledPath, fs.constants.R_OK);
|
|
186
|
+
return bundledPath;
|
|
187
|
+
}
|
|
188
|
+
catch {
|
|
189
|
+
// Not bundled
|
|
190
|
+
}
|
|
191
|
+
// 3. Development location - check relative to this file's compiled location
|
|
192
|
+
// When compiled, this is out/cli/utils.js, so base-prompts is at ../base-prompts
|
|
193
|
+
const devPath = path.resolve(__dirname, '..', 'base-prompts');
|
|
194
|
+
try {
|
|
195
|
+
fs.accessSync(devPath, fs.constants.R_OK);
|
|
196
|
+
return devPath;
|
|
197
|
+
}
|
|
198
|
+
catch {
|
|
199
|
+
// Not found
|
|
200
|
+
}
|
|
201
|
+
return undefined;
|
|
202
|
+
}
|
|
203
|
+
// ANSI color codes
|
|
204
|
+
exports.COLORS = {
|
|
205
|
+
reset: '\x1b[0m',
|
|
206
|
+
cyan: '\x1b[36m',
|
|
207
|
+
gray: '\x1b[90m',
|
|
208
|
+
dim: '\x1b[2m',
|
|
209
|
+
blue: '\x1b[34m',
|
|
210
|
+
green: '\x1b[32m',
|
|
211
|
+
red: '\x1b[31m',
|
|
212
|
+
yellow: '\x1b[33m',
|
|
213
|
+
};
|
|
214
|
+
exports.SUGGESTED_LITELLM_SMOKE_TEST_COMMAND = 'AGENTHIPPO_LITELLM_BASE_URL="http://localhost:4000" AGENTHIPPO_LITELLM_API_KEY="dummy" AGENTHIPPO_DEFAULT_MODEL="litellm/gpt-5.3-codex" AGENTHIPPO_DEFAULT_ENGINE="codex" agenthippo ask "Reply with exactly: CLI_TEST_OK"';
|
|
215
|
+
function getLiteLLMQuickstartHintLines() {
|
|
216
|
+
return [
|
|
217
|
+
'Try local LiteLLM quickstart:',
|
|
218
|
+
` ${exports.SUGGESTED_LITELLM_SMOKE_TEST_COMMAND}`,
|
|
219
|
+
];
|
|
220
|
+
}
|