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