@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
package/out/engines/codex.js
DELETED
|
@@ -1,862 +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.CodexEngine = void 0;
|
|
40
|
-
exports.registerNewFilesWithTracker = registerNewFilesWithTracker;
|
|
41
|
-
const fs_1 = require("fs");
|
|
42
|
-
const path = __importStar(require("path"));
|
|
43
|
-
const mcp_1 = require("../mcp");
|
|
44
|
-
const interfaces_1 = require("../runtime/interfaces");
|
|
45
|
-
const base_1 = require("./base");
|
|
46
|
-
const utils_1 = require("../utils");
|
|
47
|
-
const permissions_1 = require("../permissions");
|
|
48
|
-
const session_1 = require("../session");
|
|
49
|
-
const agentpack_1 = require("../agentpack");
|
|
50
|
-
const credential_context_1 = require("../cli/credential-context");
|
|
51
|
-
const runtime_1 = require("../cli/runtime");
|
|
52
|
-
const types_1 = require("../sandbox/types");
|
|
53
|
-
// Note: HTTP edit server removed - file changes are now handled directly via file_change events
|
|
54
|
-
// -----------------------------------------------------------------------------
|
|
55
|
-
// Constants
|
|
56
|
-
// -----------------------------------------------------------------------------
|
|
57
|
-
const AGENTIDE_CODEX_PROVIDER_ID = 'agentide-litellm';
|
|
58
|
-
const AGENTIDE_CODEX_CUSTOM_PROVIDER_ID = 'agentide-custom';
|
|
59
|
-
// Analytics metadata env vars for session/user/project (used by x-litellm-metadata-* and Langfuse passthrough headers)
|
|
60
|
-
const AGENTIDE_CODEX_SESSION_ENV_VAR = 'AGENTIDE_ANALYTICS_SESSION_ID';
|
|
61
|
-
const AGENTIDE_CODEX_USER_ENV_VAR = 'AGENTIDE_ANALYTICS_USER_ID';
|
|
62
|
-
const AGENTIDE_CODEX_PROJECT_ID_ENV_VAR = 'AGENTIDE_ANALYTICS_PROJECT_ID';
|
|
63
|
-
// Analytics metadata env vars for enriched OTEL traces (see PLAN/analytics-design.md)
|
|
64
|
-
const AGENTIDE_CODEX_AGENT_ID_ENV_VAR = 'AGENTIDE_ANALYTICS_AGENT_ID';
|
|
65
|
-
const AGENTIDE_CODEX_AGENT_VERSION_ENV_VAR = 'AGENTIDE_ANALYTICS_AGENT_VERSION';
|
|
66
|
-
const AGENTIDE_CODEX_SOURCE_ENV_VAR = 'AGENTIDE_ANALYTICS_SOURCE';
|
|
67
|
-
const AGENTIDE_CODEX_ENGINE_ENV_VAR = 'AGENTIDE_ANALYTICS_ENGINE';
|
|
68
|
-
const AGENTIDE_CODEX_REQUEST_ID_ENV_VAR = 'AGENTIDE_ANALYTICS_REQUEST_ID';
|
|
69
|
-
const AGENTIDE_CODEX_POLICY_VERSION_ENV_VAR = 'AGENTIDE_ANALYTICS_POLICY_VERSION';
|
|
70
|
-
const AGENTIDE_CODEX_PACK_DIGEST_ENV_VAR = 'AGENTIDE_ANALYTICS_PACK_DIGEST';
|
|
71
|
-
const AGENTIDE_CODEX_ENGINE_VERSION_ENV_VAR = 'AGENTIDE_ANALYTICS_ENGINE_VERSION';
|
|
72
|
-
const AGENTIDE_CODEX_TIER_ENV_VAR = 'AGENTIDE_ANALYTICS_TIER';
|
|
73
|
-
const AGENTIDE_CODEX_INSTANCE_ID_ENV_VAR = 'AGENTIDE_ANALYTICS_INSTANCE_ID';
|
|
74
|
-
// Bump when we change generated config semantics so long-lived sessions regenerate config.toml.
|
|
75
|
-
const AGENTIDE_CODEX_CONFIG_VERSION = 21; // v21: sandbox_mode "danger-full-access" now requires tier 2, not merely being inside a sandbox — a tier-0 home written by v20 must be rewritten
|
|
76
|
-
// Per-process runtime context for agents (not analytics): lets the agent locate its per-session context export.
|
|
77
|
-
const AGENTIDE_CONTEXT_EXPORT_PATH_ENV_VAR = 'AGENTIDE_CONTEXT_EXPORT_PATH';
|
|
78
|
-
const AGENTIDE_TERMINAL_LOG_PATH_ENV_VAR = 'AGENTIDE_TERMINAL_LOG_PATH';
|
|
79
|
-
/**
|
|
80
|
-
* Hand files codex just CREATED to the edit tracker so the IDE can render them against an empty
|
|
81
|
-
* original — without ever risking the agent's work.
|
|
82
|
-
*
|
|
83
|
-
* The IDE trick is read → delete → `applyEdit`. That delete caused live data loss: headless
|
|
84
|
-
* (`serve`/`ask`/`chat` and every sandbox) gets `NoOpEditTracker`, whose `applyEdit` does nothing, so
|
|
85
|
-
* every new file codex created was silently destroyed. The command exited 0, the file was there
|
|
86
|
-
* during the command, and it was gone by the next one — while standalone `codex exec` wrote it
|
|
87
|
-
* fine. Two guards now: skip trackers that do not write back, and restore the file if it is
|
|
88
|
-
* missing when we are done, whatever the tracker did or threw.
|
|
89
|
-
*
|
|
90
|
-
* Exported so the invariant "a file the agent created still exists after the turn" is testable.
|
|
91
|
-
*/
|
|
92
|
-
async function registerNewFilesWithTracker(files, editTracker, sessionId) {
|
|
93
|
-
// A tracker that does not write the file back must never see a delete.
|
|
94
|
-
if (editTracker.appliesEdits === false) {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
for (const f of files) {
|
|
98
|
-
try {
|
|
99
|
-
if ((0, utils_1.isBinaryFile)(f)) {
|
|
100
|
-
continue; // Binary would be corrupted by the UTF-8 read/write round trip.
|
|
101
|
-
}
|
|
102
|
-
if (!(await (0, utils_1.pathExists)(f))) {
|
|
103
|
-
continue;
|
|
104
|
-
}
|
|
105
|
-
const code = await fs_1.promises.readFile(f, 'utf-8');
|
|
106
|
-
try {
|
|
107
|
-
await fs_1.promises.unlink(f);
|
|
108
|
-
await editTracker.applyEdit(sessionId, f, code, true);
|
|
109
|
-
}
|
|
110
|
-
finally {
|
|
111
|
-
if (!(await (0, utils_1.pathExists)(f))) {
|
|
112
|
-
await fs_1.promises.writeFile(f, code, 'utf-8');
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
catch { /* ignore — never fail a turn over edit-diff bookkeeping */ }
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
function isCodexItemEvent(event) {
|
|
120
|
-
return event.type === 'item.started' || event.type === 'item.updated' || event.type === 'item.completed';
|
|
121
|
-
}
|
|
122
|
-
// -----------------------------------------------------------------------------
|
|
123
|
-
// Codex Engine
|
|
124
|
-
// -----------------------------------------------------------------------------
|
|
125
|
-
class CodexEngine {
|
|
126
|
-
config;
|
|
127
|
-
getSkillsSignature;
|
|
128
|
-
getBundledBasePromptsDir;
|
|
129
|
-
id = 'codex';
|
|
130
|
-
displayName = 'Codex';
|
|
131
|
-
lastWrittenConfigSignature;
|
|
132
|
-
lastCodexSkillsSignatureByWorkspaceRoot = new Map();
|
|
133
|
-
constructor(config, getSkillsSignature, getBundledBasePromptsDir) {
|
|
134
|
-
this.config = config;
|
|
135
|
-
this.getSkillsSignature = getSkillsSignature;
|
|
136
|
-
this.getBundledBasePromptsDir = getBundledBasePromptsDir;
|
|
137
|
-
}
|
|
138
|
-
async stream(message, options, emitter, runtime, signal) {
|
|
139
|
-
// Use logger from runtime context
|
|
140
|
-
const logger = runtime.logger;
|
|
141
|
-
// Edit tracker from runtime context (optional)
|
|
142
|
-
const editTracker = runtime.editTracker;
|
|
143
|
-
const { Codex } = await import('@openai/codex-sdk');
|
|
144
|
-
if (!options.modelId) {
|
|
145
|
-
throw new Error('Codex modelId not provided for streaming request');
|
|
146
|
-
}
|
|
147
|
-
// IMPORTANT: Do NOT strip the `litellm/` prefix. In LiteLLM deployments, the model identifier
|
|
148
|
-
// is often an alias that must match exactly (e.g. `litellm/gpt-4o-mini`).
|
|
149
|
-
const threadModelId = options.modelId;
|
|
150
|
-
// Resolve API routing (LiteLLM proxy vs direct OpenAI)
|
|
151
|
-
// Use openaiBaseUrl which has overrideOpenAIBaseUrl applied
|
|
152
|
-
// codex routes to OpenAI when direct (or the LiteLLM proxy when configured) — never Anthropic.
|
|
153
|
-
const routing = (0, utils_1.resolveApiRouting)(options, this.config, 'openai');
|
|
154
|
-
const apiKey = routing.apiKey;
|
|
155
|
-
const baseUrl = routing.openaiBaseUrl; // Use OpenAI-specific URL
|
|
156
|
-
const useLiteLLM = routing.useLiteLLM;
|
|
157
|
-
const sessionId = options.sessionId;
|
|
158
|
-
const analyticsUserId = options.analyticsUserId;
|
|
159
|
-
const analyticsProjectId = (0, base_1.resolveAnalyticsProjectId)(options.analyticsProjectId, options.workspaceRoot);
|
|
160
|
-
// Detect if this is a custom endpoint (not direct OpenAI API).
|
|
161
|
-
// The default OpenAI endpoint is https://api.openai.com/v1 - don't treat as custom for that.
|
|
162
|
-
const DEFAULT_OPENAI_ENDPOINT = 'https://api.openai.com/v1';
|
|
163
|
-
const isCustomEndpoint = baseUrl && baseUrl !== DEFAULT_OPENAI_ENDPOINT;
|
|
164
|
-
const routingDescription = useLiteLLM ? 'LiteLLM proxy' : (isCustomEndpoint ? 'custom provider' : 'direct OpenAI');
|
|
165
|
-
logger.info(`[AgentIDE] Codex routing: ${routingDescription}, baseUrl=${baseUrl || 'default'}, workspaceRoot=${options.workspaceRoot}`);
|
|
166
|
-
const isClaudeModel = threadModelId.toLowerCase().includes('claude');
|
|
167
|
-
// Codex CLI no longer supports wire_api=chat (see openai/codex#7782); always use responses.
|
|
168
|
-
const wireApi = 'responses';
|
|
169
|
-
logger.info(`[AgentIDE] Codex wire_api=${wireApi} (model=${threadModelId})`);
|
|
170
|
-
if (isClaudeModel && (useLiteLLM || isCustomEndpoint)) {
|
|
171
|
-
logger.info('[AgentIDE] Codex note: selected model appears to be Claude via proxy; reasoning summaries depend on provider support over the Responses API.');
|
|
172
|
-
}
|
|
173
|
-
// Build environment for Codex SDK (spawns internal CLI binary)
|
|
174
|
-
const codexEnv = {
|
|
175
|
-
...process.env,
|
|
176
|
-
...(runtime.cliEnvPatch ?? {}),
|
|
177
|
-
OPENAI_LOG: 'debug',
|
|
178
|
-
};
|
|
179
|
-
// The OpenClaw gateway token must never enter the agent's trust domain (secure-obo-design
|
|
180
|
-
// §7.6 / §7.4 gap 1). UNCONDITIONALLY (serve-v4 §10 hole 2): the scrub used to depend on
|
|
181
|
-
// the egress broker being up, so a deployment without --gateway-bridge re-inherited the
|
|
182
|
-
// token — and buildCliEnvPatch can bake it in from the host's ~/.openclaw config, not just
|
|
183
|
-
// process.env. This engine never needs it: outbound goes through the broker's turn nonce,
|
|
184
|
-
// and the openclaw CLI reads its own config file on single-tenant hosts.
|
|
185
|
-
delete codexEnv[runtime_1.OPENCLAW_GATEWAY_TOKEN_ENV];
|
|
186
|
-
// Data-plane sidecar control token: the engine only needs the gateway URL + its per-turn
|
|
187
|
-
// nonce, never the register token — scrub it so a compromised agent can't forge a turn as
|
|
188
|
-
// another user (secure-obo-design §7.6). Harmless when absent (in-process/no data plane).
|
|
189
|
-
delete codexEnv['AGENTHIPPO_DATA_PLANE_TOKEN'];
|
|
190
|
-
// Always expose the VS Code chat session id to the agent process so it can locate:
|
|
191
|
-
// .agentide/sessions/<sessionId>/context.md
|
|
192
|
-
const rawChatSessionId = sessionId?.trim();
|
|
193
|
-
const contextSessionId = options.contextSessionId?.trim() || rawChatSessionId;
|
|
194
|
-
if (contextSessionId) {
|
|
195
|
-
codexEnv[AGENTIDE_CONTEXT_EXPORT_PATH_ENV_VAR] = path.join(options.workspaceRoot, agentpack_1.AGENT_CONSTANTS.AGENTIDE_DIR_NAME, 'sessions', contextSessionId, 'context.md');
|
|
196
|
-
codexEnv[AGENTIDE_TERMINAL_LOG_PATH_ENV_VAR] = path.join(options.workspaceRoot, agentpack_1.AGENT_CONSTANTS.AGENTIDE_DIR_NAME, 'sessions', contextSessionId, 'terminal.md');
|
|
197
|
-
}
|
|
198
|
-
// Note: With full permissions, Codex writes files directly to disk.
|
|
199
|
-
// File changes are detected via the file_change event stream and
|
|
200
|
-
// routed through VS Code's edit session automatically.
|
|
201
|
-
// Resolve runtime paths for config directories (agent-isolated)
|
|
202
|
-
// Note: workingDirectory is ALWAYS workspaceRoot - active agent content is synced to workspace's .codex/
|
|
203
|
-
const agentId = options.agentPackId ?? 'default';
|
|
204
|
-
const runtimePaths = (0, agentpack_1.resolveRuntimePaths)(options.workspaceRoot, this.config.storagePath, agentId, options.agentPackVersion);
|
|
205
|
-
// Use agent-isolated CODEX_HOME (for session/state isolation). In multi-tenant serve,
|
|
206
|
-
// additionally key it by the verified request user: config.toml is rewritten per turn,
|
|
207
|
-
// and a shared per-agent home lets concurrent turns of different users race it
|
|
208
|
-
// (secure-obo-design §1 defect 1 / §8 Phase 0). No credential frame (IDE,
|
|
209
|
-
// single-tenant CLI) ⇒ unchanged per-agent path.
|
|
210
|
-
const codexHome = (0, agentpack_1.userScopedEngineHome)(runtimePaths.codexHome, (0, credential_context_1.currentCredential)()?.userId);
|
|
211
|
-
codexEnv['CODEX_HOME'] = codexHome;
|
|
212
|
-
await fs_1.promises.mkdir(codexHome, { recursive: true });
|
|
213
|
-
// Always set AGENT_ID for agent to know its identity
|
|
214
|
-
codexEnv['AGENT_ID'] = agentId;
|
|
215
|
-
if (options.agentPackVersion) {
|
|
216
|
-
codexEnv['AGENTIDE_AGENT_VERSION'] = options.agentPackVersion;
|
|
217
|
-
}
|
|
218
|
-
if (agentId !== 'default') {
|
|
219
|
-
logger.info(`[AgentIDE] Codex using agent: ${agentId}, CODEX_HOME=${codexHome} (agent-isolated)`);
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
logger.info(`[AgentIDE] Codex using default agent, CODEX_HOME=${codexHome}`);
|
|
223
|
-
}
|
|
224
|
-
// Only pass baseUrl to config when using a custom endpoint (not default OpenAI)
|
|
225
|
-
const customBaseUrl = isCustomEndpoint ? baseUrl : undefined;
|
|
226
|
-
await this.ensureCodexConfig(useLiteLLM, customBaseUrl, threadModelId,
|
|
227
|
-
// Always use workspaceRoot - pack content is synced to workspace's .codex/
|
|
228
|
-
options.workspaceRoot, options.additionalDirectories ?? [], logger, codexHome, // Pass explicit codexHome for pack support
|
|
229
|
-
agentId, // Pass agent ID for correct skills path
|
|
230
|
-
runtime.permissionHandler instanceof interfaces_1.AutoApprovePermissionHandler);
|
|
231
|
-
// LiteLLM analytics metadata (enriched - see PLAN/analytics-design.md)
|
|
232
|
-
//
|
|
233
|
-
// Gate on the codexHome actually in use (resolved above), NOT `this.config.codexHome`:
|
|
234
|
-
// headless/index.ts passes `codexHome: undefined`, so under serve/ask/chat and inside
|
|
235
|
-
// every sandbox this block was skipped and codex sent NO metadata headers at all — no
|
|
236
|
-
// session-id, user-id, agent-id, source, request-id, or engine. Spotlight lost codex
|
|
237
|
-
// attribution outside the IDE, and the gateway could not see `x-litellm-metadata-engine`,
|
|
238
|
-
// so engine-conditional ah-auto routing never fired. config.toml was written correctly
|
|
239
|
-
// the whole time (it uses this same resolved home) — only the env vars it reads were missing.
|
|
240
|
-
if (useLiteLLM && codexHome) {
|
|
241
|
-
if (analyticsUserId?.trim()) {
|
|
242
|
-
codexEnv[AGENTIDE_CODEX_USER_ENV_VAR] = analyticsUserId.trim();
|
|
243
|
-
}
|
|
244
|
-
if (sessionId?.trim()) {
|
|
245
|
-
codexEnv[AGENTIDE_CODEX_SESSION_ENV_VAR] = sessionId.trim();
|
|
246
|
-
}
|
|
247
|
-
if (analyticsProjectId?.trim()) {
|
|
248
|
-
codexEnv[AGENTIDE_CODEX_PROJECT_ID_ENV_VAR] = analyticsProjectId.trim();
|
|
249
|
-
}
|
|
250
|
-
codexEnv[AGENTIDE_CODEX_AGENT_ID_ENV_VAR] = agentId;
|
|
251
|
-
codexEnv[AGENTIDE_CODEX_AGENT_VERSION_ENV_VAR] = options.agentPackVersion ?? 'workspace';
|
|
252
|
-
codexEnv[AGENTIDE_CODEX_SOURCE_ENV_VAR] = 'agenthippo';
|
|
253
|
-
codexEnv[AGENTIDE_CODEX_ENGINE_ENV_VAR] = 'codex';
|
|
254
|
-
// Use requestId from options (generated by caller) for Layer 1/Layer 2 correlation
|
|
255
|
-
if (options.requestId) {
|
|
256
|
-
codexEnv[AGENTIDE_CODEX_REQUEST_ID_ENV_VAR] = options.requestId;
|
|
257
|
-
}
|
|
258
|
-
if (options.policyVersion?.trim()) {
|
|
259
|
-
codexEnv[AGENTIDE_CODEX_POLICY_VERSION_ENV_VAR] = options.policyVersion.trim();
|
|
260
|
-
}
|
|
261
|
-
if (options.packDigest?.trim()) {
|
|
262
|
-
codexEnv[AGENTIDE_CODEX_PACK_DIGEST_ENV_VAR] = options.packDigest.trim();
|
|
263
|
-
}
|
|
264
|
-
if (options.engineVersion?.trim()) {
|
|
265
|
-
codexEnv[AGENTIDE_CODEX_ENGINE_VERSION_ENV_VAR] = options.engineVersion.trim();
|
|
266
|
-
}
|
|
267
|
-
if (options.tier !== undefined) {
|
|
268
|
-
codexEnv[AGENTIDE_CODEX_TIER_ENV_VAR] = String(options.tier);
|
|
269
|
-
}
|
|
270
|
-
if (options.instanceId?.trim()) {
|
|
271
|
-
codexEnv[AGENTIDE_CODEX_INSTANCE_ID_ENV_VAR] = options.instanceId.trim();
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
// For custom providers (OpenRouter, LiteLLM), set API key in CODEX_API_KEY.
|
|
275
|
-
// The config.toml's `env_key = "CODEX_API_KEY"` tells the CLI to read from this variable.
|
|
276
|
-
if (isCustomEndpoint && apiKey) {
|
|
277
|
-
codexEnv['CODEX_API_KEY'] = apiKey;
|
|
278
|
-
}
|
|
279
|
-
// Only set OPENAI_BASE_URL for custom endpoints (not direct OpenAI API)
|
|
280
|
-
if (isCustomEndpoint) {
|
|
281
|
-
codexEnv['OPENAI_BASE_URL'] = baseUrl;
|
|
282
|
-
logger.info(`[AgentIDE] Using custom OpenAI base URL: ${baseUrl}`);
|
|
283
|
-
if ((0, utils_1.applyLocalTlsBypass)(codexEnv, baseUrl)) {
|
|
284
|
-
logger.info('[AgentIDE] Disabling TLS verification for local HTTPS (Codex)');
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
const convo = (0, session_1.buildConversationKey)('codex', options);
|
|
288
|
-
logger.info(`[AgentIDE] Codex conversationKey=${convo.key} (chatSessionId=${convo.chatSessionId}, signature=${convo.signatureHash}${convo.isEphemeral ? ', ephemeral' : ''})`);
|
|
289
|
-
await (0, session_1.withConversationLock)(convo.key, async () => {
|
|
290
|
-
await emitter.progress('Thinking...');
|
|
291
|
-
// Resolve unified permissions (from manifest via options, or defaults)
|
|
292
|
-
const effectivePerms = options.permissions ?? permissions_1.DEFAULT_PERMISSIONS;
|
|
293
|
-
logger.info(`[AgentIDE] Codex permissions: fileAccess=${effectivePerms.fileAccess}`);
|
|
294
|
-
// Build workspace folders list for permission mapping
|
|
295
|
-
const workspaceFolders = [
|
|
296
|
-
options.workspaceRoot,
|
|
297
|
-
...(options.additionalDirectories ?? []),
|
|
298
|
-
];
|
|
299
|
-
// Map unified permissions to Codex SDK options
|
|
300
|
-
const codexPermOpts = (0, permissions_1.toCodexOptions)(effectivePerms, workspaceFolders);
|
|
301
|
-
// One boundary, not two — but only when the OTHER boundary is real. Inside a tier-2
|
|
302
|
-
// container Codex's own bubblewrap sandbox cannot start (it needs a user namespace
|
|
303
|
-
// `--cap-drop ALL` + `no-new-privileges` deny), so standing it down is the difference
|
|
304
|
-
// between working shell commands and silent failures. The tier-0 process driver
|
|
305
|
-
// provides NO boundary — same uid, same filesystem as serve — so there Codex's own
|
|
306
|
-
// sandbox is the only thing between the agent and the host and must stay on.
|
|
307
|
-
// The SDK's ThreadOptions.sandboxMode overrides config.toml, so force it here too.
|
|
308
|
-
if ((0, types_1.isContainerSandbox)()) {
|
|
309
|
-
codexPermOpts.sandboxMode = 'danger-full-access';
|
|
310
|
-
}
|
|
311
|
-
logger.info(`[AgentIDE] Codex mapped: sandboxMode=${codexPermOpts.sandboxMode}, approvalPolicy=${codexPermOpts.approvalPolicy}`);
|
|
312
|
-
// Build thread options
|
|
313
|
-
// workingDirectory is ALWAYS workspaceRoot - pack content is synced to workspace's .codex/
|
|
314
|
-
const threadWorkingDir = options.workspaceRoot;
|
|
315
|
-
const threadOptions = {
|
|
316
|
-
model: threadModelId,
|
|
317
|
-
// Use mapped permissions from unified AgentPermissions
|
|
318
|
-
sandboxMode: codexPermOpts.sandboxMode,
|
|
319
|
-
approvalPolicy: codexPermOpts.approvalPolicy,
|
|
320
|
-
additionalDirectories: codexPermOpts.additionalDirectories,
|
|
321
|
-
workingDirectory: threadWorkingDir,
|
|
322
|
-
// Allow running in non-git directories (e.g., new projects, ephemeral environments)
|
|
323
|
-
skipGitRepoCheck: true,
|
|
324
|
-
modelReasoningEffort: 'medium',
|
|
325
|
-
};
|
|
326
|
-
logger.info(`[AgentIDE] Codex modelReasoningEffort=${threadOptions.modelReasoningEffort ?? 'default'}`);
|
|
327
|
-
// For custom providers (OpenRouter, LiteLLM), the API key is read from
|
|
328
|
-
// CODEX_API_KEY env var via config.toml's env_key. Only pass apiKey
|
|
329
|
-
// directly to the constructor for direct OpenAI mode.
|
|
330
|
-
const codexApiKey = isCustomEndpoint ? undefined : apiKey;
|
|
331
|
-
const codex = new Codex({
|
|
332
|
-
apiKey: codexApiKey,
|
|
333
|
-
env: codexEnv,
|
|
334
|
-
...(this.config.codexExecutablePath ? { codexPathOverride: this.config.codexExecutablePath } : {}),
|
|
335
|
-
});
|
|
336
|
-
// const codex = new Codex({
|
|
337
|
-
// apiKey: codexApiKey,
|
|
338
|
-
// env: codexEnv,
|
|
339
|
-
// // Override Codex binary path for bundled CLI distribution
|
|
340
|
-
// ...(this.config.codexExecutablePath ? { codexPathOverride: this.config.codexExecutablePath } : {}),
|
|
341
|
-
// });
|
|
342
|
-
const threadIdToResume = (0, base_1.getPersistedSessionId)('codex', convo.key);
|
|
343
|
-
let thread;
|
|
344
|
-
if (threadIdToResume) {
|
|
345
|
-
try {
|
|
346
|
-
// Resume with the current model -- thread history persists across model changes
|
|
347
|
-
thread = codex.resumeThread(threadIdToResume, threadOptions);
|
|
348
|
-
logger.info(`[AgentIDE] Codex resuming thread: ${threadIdToResume} (model: ${threadModelId})`);
|
|
349
|
-
}
|
|
350
|
-
catch (e) {
|
|
351
|
-
logger.warn(`[AgentIDE] Failed to resume Codex thread (${threadIdToResume}): ${e instanceof Error ? e.message : String(e)}. Starting new thread.`);
|
|
352
|
-
thread = codex.startThread(threadOptions);
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
else {
|
|
356
|
-
thread = codex.startThread(threadOptions);
|
|
357
|
-
logger.info(`[AgentIDE] Codex starting new thread (model: ${threadModelId})`);
|
|
358
|
-
}
|
|
359
|
-
if (signal?.aborted) {
|
|
360
|
-
logger.info('[AgentIDE] Codex stream cancelled before starting turn');
|
|
361
|
-
return;
|
|
362
|
-
}
|
|
363
|
-
let events;
|
|
364
|
-
try {
|
|
365
|
-
({ events } = await thread.runStreamed(message, { signal }));
|
|
366
|
-
}
|
|
367
|
-
catch (e) {
|
|
368
|
-
if (signal?.aborted) {
|
|
369
|
-
logger.info('[AgentIDE] Codex stream aborted while starting turn');
|
|
370
|
-
return;
|
|
371
|
-
}
|
|
372
|
-
throw e;
|
|
373
|
-
}
|
|
374
|
-
const textTracker = new Map();
|
|
375
|
-
const pendingOperations = new Map(); // command item.id → operationId
|
|
376
|
-
const pendingNewFiles = new Map(); // command item.id → new file paths
|
|
377
|
-
let reasoningDeltaCount = 0;
|
|
378
|
-
let reasoningCharCount = 0;
|
|
379
|
-
let reasoningItemSeen = 0;
|
|
380
|
-
let loggedEmptyReasoningOnce = false;
|
|
381
|
-
const preview = (s) => s.replace(/\r/g, '').replace(/\n/g, '\\n').slice(0, 160);
|
|
382
|
-
try {
|
|
383
|
-
for await (const event of events) {
|
|
384
|
-
if (signal?.aborted) {
|
|
385
|
-
logger.info('[AgentIDE] Codex stream aborted; stopping event loop');
|
|
386
|
-
return;
|
|
387
|
-
}
|
|
388
|
-
const itemType = isCodexItemEvent(event) ? event.item.type : undefined;
|
|
389
|
-
logger.debug(`[AgentIDE] Codex event: ${event.type}${itemType ? ` (item: ${itemType})` : ''}`);
|
|
390
|
-
if (event.type === 'thread.started') {
|
|
391
|
-
const started = event;
|
|
392
|
-
const threadId = started.thread_id;
|
|
393
|
-
logger.info(`[AgentIDE] Codex thread started: ${threadId}`);
|
|
394
|
-
await (0, base_1.persistSessionIfNeeded)('codex', convo, threadId, options);
|
|
395
|
-
continue;
|
|
396
|
-
}
|
|
397
|
-
if (event.type === 'turn.failed') {
|
|
398
|
-
await emitter.error(event.error?.message || 'Codex turn failed');
|
|
399
|
-
throw new Error(event.error?.message || 'Codex turn failed');
|
|
400
|
-
}
|
|
401
|
-
if (event.type === 'error') {
|
|
402
|
-
await emitter.error(event.message || 'Codex stream error');
|
|
403
|
-
throw new Error(event.message || 'Codex stream error');
|
|
404
|
-
}
|
|
405
|
-
if (event.type === 'turn.completed') {
|
|
406
|
-
logger.info(`[AgentIDE] Codex usage: input=${event.usage.input_tokens}, cached=${event.usage.cached_input_tokens}, output=${event.usage.output_tokens}`);
|
|
407
|
-
continue;
|
|
408
|
-
}
|
|
409
|
-
if (isCodexItemEvent(event)) {
|
|
410
|
-
const { item } = event;
|
|
411
|
-
if (item.type === 'reasoning') {
|
|
412
|
-
reasoningItemSeen++;
|
|
413
|
-
const full = item.text ?? '';
|
|
414
|
-
const delta = (0, utils_1.computeTextDelta)(item.id, item.text ?? '', textTracker);
|
|
415
|
-
if (delta) {
|
|
416
|
-
reasoningDeltaCount++;
|
|
417
|
-
reasoningCharCount += delta.length;
|
|
418
|
-
if (reasoningDeltaCount <= 3) {
|
|
419
|
-
logger.debug(`[AgentIDE] Codex reasoning delta #${reasoningDeltaCount} (${delta.length} chars): ${preview(delta)}`);
|
|
420
|
-
}
|
|
421
|
-
await emitter.thinking(delta);
|
|
422
|
-
}
|
|
423
|
-
else if (!loggedEmptyReasoningOnce && full.length === 0) {
|
|
424
|
-
loggedEmptyReasoningOnce = true;
|
|
425
|
-
logger.debug('[AgentIDE] Codex reasoning item observed but text is empty so far.');
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
else if (item.type === 'agent_message') {
|
|
429
|
-
const delta = (0, utils_1.computeTextDelta)(item.id, item.text ?? '', textTracker);
|
|
430
|
-
if (delta) {
|
|
431
|
-
await emitter.text(delta);
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
else if (item.type === 'command_execution') {
|
|
435
|
-
if (event.type === 'item.started') {
|
|
436
|
-
// Emit command as thinking so users can see what's being executed
|
|
437
|
-
await emitter.thinking(`**Running command**\n\`\`\`bash\n${item.command}\n\`\`\`\n`);
|
|
438
|
-
await emitter.toolStart('terminal', item.command, item.id, {
|
|
439
|
-
kind: 'terminal',
|
|
440
|
-
language: 'bash',
|
|
441
|
-
});
|
|
442
|
-
// Set up edit tracking for files in command
|
|
443
|
-
// Filter out binary files - they can't be diffed as text
|
|
444
|
-
if (rawChatSessionId && item.command && editTracker) {
|
|
445
|
-
const files = (0, utils_1.extractFilePaths)(item.command, options.workspaceRoot).filter(f => !(0, utils_1.isBinaryFile)(f));
|
|
446
|
-
if (files.length > 0) {
|
|
447
|
-
if ((0, utils_1.isCreateCommand)(item.command)) {
|
|
448
|
-
// Create command: all files are new
|
|
449
|
-
pendingNewFiles.set(item.id, files);
|
|
450
|
-
}
|
|
451
|
-
else {
|
|
452
|
-
// Modify command: partition by existence (parallel check)
|
|
453
|
-
const checks = await Promise.all(files.map(async (f) => [f, await (0, utils_1.pathExists)(f)]));
|
|
454
|
-
const existing = checks.filter(([, exists]) => exists).map(([f]) => f);
|
|
455
|
-
const created = checks.filter(([, exists]) => !exists).map(([f]) => f);
|
|
456
|
-
if (created.length > 0) {
|
|
457
|
-
pendingNewFiles.set(item.id, created);
|
|
458
|
-
}
|
|
459
|
-
if (existing.length > 0) {
|
|
460
|
-
try {
|
|
461
|
-
const r = await editTracker.startTracking(rawChatSessionId, existing);
|
|
462
|
-
if (r?.operationId !== undefined) {
|
|
463
|
-
pendingOperations.set(item.id, r.operationId);
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
catch { /* ignore */ }
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
// Stream command output as thinking content
|
|
473
|
-
if (event.type === 'item.updated' || event.type === 'item.completed') {
|
|
474
|
-
const outputDelta = (0, utils_1.computeTextDelta)(`${item.id}-output`, item.aggregated_output ?? '', textTracker);
|
|
475
|
-
if (outputDelta) {
|
|
476
|
-
await emitter.thinking(outputDelta);
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
if (event.type === 'item.completed') {
|
|
480
|
-
const exitMsg = item.exit_code !== undefined
|
|
481
|
-
// allow-any-unicode-next-line
|
|
482
|
-
? (item.exit_code === 0 ? '✓ Command completed' : `✗ Exited with code ${item.exit_code}`)
|
|
483
|
-
: '✓ Command completed';
|
|
484
|
-
await emitter.thinking(`\n${exitMsg}\n`);
|
|
485
|
-
await emitter.toolEnd('terminal', item.id, item.exit_code !== undefined ? `Exited with code ${item.exit_code}` : 'Completed', item.exit_code !== undefined ? item.exit_code !== 0 : false, { exitCode: item.exit_code });
|
|
486
|
-
// Finalize edit tracking
|
|
487
|
-
if (rawChatSessionId && editTracker) {
|
|
488
|
-
// Existing files: stop edit tracking to compute diffs
|
|
489
|
-
const opId = pendingOperations.get(item.id);
|
|
490
|
-
if (opId !== undefined) {
|
|
491
|
-
try {
|
|
492
|
-
await editTracker.stopTracking(rawChatSessionId, opId);
|
|
493
|
-
}
|
|
494
|
-
catch { /* ignore */ }
|
|
495
|
-
pendingOperations.delete(item.id);
|
|
496
|
-
}
|
|
497
|
-
await registerNewFilesWithTracker(pendingNewFiles.get(item.id) ?? [], editTracker, rawChatSessionId);
|
|
498
|
-
pendingNewFiles.delete(item.id);
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
else if (item.type === 'mcp_tool_call') {
|
|
503
|
-
if (event.type === 'item.started') {
|
|
504
|
-
// Emit MCP tool call as thinking
|
|
505
|
-
const argsStr = item.arguments ? `\n\`\`\`json\n${JSON.stringify(item.arguments, null, 2)}\n\`\`\`` : '';
|
|
506
|
-
await emitter.thinking(`**Calling MCP tool** \`${item.server}.${item.tool}\`${argsStr}\n`);
|
|
507
|
-
const argsPreview = item.arguments
|
|
508
|
-
? JSON.stringify(item.arguments, null, 2).slice(0, 400)
|
|
509
|
-
: '';
|
|
510
|
-
await emitter.toolStart(`${item.server}.${item.tool}`, argsPreview, item.id, { arguments: item.arguments });
|
|
511
|
-
}
|
|
512
|
-
if (event.type === 'item.completed') {
|
|
513
|
-
// Show MCP result or error
|
|
514
|
-
if (item.error?.message) {
|
|
515
|
-
// allow-any-unicode-next-line
|
|
516
|
-
await emitter.thinking(`\n✗ MCP error: ${item.error.message}\n`);
|
|
517
|
-
await emitter.toolEnd(`${item.server}.${item.tool}`, item.id, item.error.message, true, { error: item.error });
|
|
518
|
-
}
|
|
519
|
-
else if (item.result) {
|
|
520
|
-
const resultStr = JSON.stringify(item.result.structured_content ?? item.result.content, null, 2);
|
|
521
|
-
const truncated = resultStr.length > 500 ? resultStr.slice(0, 500) + '...' : resultStr;
|
|
522
|
-
await emitter.thinking(`\n✓ MCP result:\n\`\`\`json\n${truncated}\n\`\`\`\n`);
|
|
523
|
-
await emitter.toolEnd(`${item.server}.${item.tool}`, item.id, 'MCP call completed', false, { result: item.result });
|
|
524
|
-
}
|
|
525
|
-
else {
|
|
526
|
-
await emitter.toolEnd(`${item.server}.${item.tool}`, item.id, 'MCP call completed', false);
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
else if (item.type === 'file_change') {
|
|
531
|
-
if (event.type === 'item.started') {
|
|
532
|
-
const files = item.changes.map(c => `${c.kind} ${c.path}`).join(', ');
|
|
533
|
-
await emitter.thinking(`**File changes:** ${files}\n`);
|
|
534
|
-
await emitter.progress(`[Files] ${files}`);
|
|
535
|
-
// Start edit tracking BEFORE files are modified (snapshot current state)
|
|
536
|
-
// Filter out binary files - they can't be diffed as text
|
|
537
|
-
if (!rawChatSessionId) {
|
|
538
|
-
logger.debug(`[AgentIDE] Codex file_change: skipping edit tracking (no session ID)`);
|
|
539
|
-
}
|
|
540
|
-
else if (!editTracker) {
|
|
541
|
-
logger.warn(`[AgentIDE] Codex file_change: skipping edit tracking (no editTracker)`);
|
|
542
|
-
}
|
|
543
|
-
if (rawChatSessionId && editTracker) {
|
|
544
|
-
const filePaths = item.changes
|
|
545
|
-
.filter(c => {
|
|
546
|
-
const normalizedKind = (0, utils_1.normalizeFileChangeKind)(String(c.kind));
|
|
547
|
-
return (normalizedKind === 'create' || normalizedKind === 'modify') && !(0, utils_1.isBinaryFile)(c.path);
|
|
548
|
-
})
|
|
549
|
-
.map(c => {
|
|
550
|
-
// Resolve relative paths to absolute using workspaceRoot
|
|
551
|
-
return path.isAbsolute(c.path) ? c.path : path.join(options.workspaceRoot, c.path);
|
|
552
|
-
});
|
|
553
|
-
if (filePaths.length > 0) {
|
|
554
|
-
logger.info(`[AgentIDE] Codex file_change: starting edit tracking for ${filePaths.length} files: ${filePaths.join(', ')}`);
|
|
555
|
-
try {
|
|
556
|
-
const result = await editTracker.startTracking(rawChatSessionId, filePaths);
|
|
557
|
-
if (result?.operationId !== undefined) {
|
|
558
|
-
pendingOperations.set(item.id, result.operationId);
|
|
559
|
-
logger.info(`[AgentIDE] Codex file_change: edit tracking started (op=${result.operationId})`);
|
|
560
|
-
}
|
|
561
|
-
else {
|
|
562
|
-
logger.warn(`[AgentIDE] Codex file_change: startTracking returned no operationId`);
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
catch (e) {
|
|
566
|
-
logger.warn(`[AgentIDE] Codex file_change: failed to start edit tracking: ${e}`);
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
else {
|
|
570
|
-
logger.debug(`[AgentIDE] Codex file_change: no trackable files (all filtered out)`);
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
if (event.type === 'item.completed') {
|
|
575
|
-
// allow-any-unicode-next-line
|
|
576
|
-
const statusEmoji = item.status === 'completed' ? '✓' : '✗';
|
|
577
|
-
await emitter.thinking(`${statusEmoji} File changes ${item.status}\n`);
|
|
578
|
-
// Stop edit tracking AFTER files are modified (compute diffs from disk)
|
|
579
|
-
const operationId = pendingOperations.get(item.id);
|
|
580
|
-
if (rawChatSessionId && operationId !== undefined && editTracker) {
|
|
581
|
-
try {
|
|
582
|
-
await editTracker.stopTracking(rawChatSessionId, operationId);
|
|
583
|
-
logger.debug(`[AgentIDE] Stopped edit tracking (op=${operationId})`);
|
|
584
|
-
}
|
|
585
|
-
catch (e) {
|
|
586
|
-
logger.warn(`[AgentIDE] Failed to stop edit tracking: ${e}`);
|
|
587
|
-
}
|
|
588
|
-
finally {
|
|
589
|
-
pendingOperations.delete(item.id);
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
else if (item.type === 'web_search') {
|
|
595
|
-
if (event.type === 'item.started') {
|
|
596
|
-
await emitter.thinking(`**Web search:** ${item.query}\n`);
|
|
597
|
-
await emitter.toolStart('web_search', item.query, item.id, { query: item.query });
|
|
598
|
-
}
|
|
599
|
-
if (event.type === 'item.completed') {
|
|
600
|
-
await emitter.toolEnd('web_search', item.id, 'Search completed', false, { query: item.query });
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
else if (item.type === 'todo_list') {
|
|
604
|
-
// Codex often does not emit "reasoning" text; stream the plan into Thinking as a useful transparency fallback.
|
|
605
|
-
if (event.type === 'item.started') {
|
|
606
|
-
const lines = item.items.map(i => `- [${i.completed ? 'x' : ' '}] ${i.text}`);
|
|
607
|
-
await emitter.thinking(`**Plan**\n${lines.join('\n')}\n`);
|
|
608
|
-
}
|
|
609
|
-
if (event.type === 'item.updated') {
|
|
610
|
-
// Update plan progress as thinking
|
|
611
|
-
const lines = item.items.map(i => `- [${i.completed ? 'x' : ' '}] ${i.text}`);
|
|
612
|
-
await emitter.thinking(`**Plan update**\n${lines.join('\n')}\n`);
|
|
613
|
-
}
|
|
614
|
-
if (event.type === 'item.started' || event.type === 'item.completed') {
|
|
615
|
-
const completed = item.items.filter(i => i.completed).length;
|
|
616
|
-
await emitter.progress(`[Plan] ${completed}/${item.items.length} steps complete`);
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
else if (item.type === 'error') {
|
|
620
|
-
// NOTE: Codex CLI surfaces non-fatal warnings as `ErrorItem`s in the event stream
|
|
621
|
-
const msg = item.message || 'Codex warning';
|
|
622
|
-
logger.warn(`[AgentIDE] Codex warning: ${msg}`);
|
|
623
|
-
await emitter.thinking(`**Warning:** ${msg}\n`);
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
catch (e) {
|
|
629
|
-
if (signal?.aborted) {
|
|
630
|
-
logger.info(`[AgentIDE] Codex stream aborted: ${e instanceof Error ? e.message : String(e)}`);
|
|
631
|
-
return;
|
|
632
|
-
}
|
|
633
|
-
throw e;
|
|
634
|
-
}
|
|
635
|
-
logger.info(`[AgentIDE] Codex reasoning summary: items=${reasoningItemSeen}, deltas=${reasoningDeltaCount}, chars=${reasoningCharCount}`);
|
|
636
|
-
if (reasoningItemSeen === 0) {
|
|
637
|
-
logger.debug('[AgentIDE] Codex emitted no reasoning items. This SDK only exposes a reasoning *summary* when available; many runs may have none.');
|
|
638
|
-
}
|
|
639
|
-
(0, base_1.touchSessionIfNeeded)(convo);
|
|
640
|
-
}, {
|
|
641
|
-
signal,
|
|
642
|
-
// Agent turns may run for hours; keep this high as a safety net only.
|
|
643
|
-
timeoutMs: session_1.DEFAULT_CONVERSATION_LOCK_TIMEOUT_MS,
|
|
644
|
-
label: 'codex.stream'
|
|
645
|
-
});
|
|
646
|
-
await emitter.done();
|
|
647
|
-
logger.info('[AgentIDE] Codex streaming complete');
|
|
648
|
-
}
|
|
649
|
-
dispose() {
|
|
650
|
-
this.lastWrittenConfigSignature = undefined;
|
|
651
|
-
this.lastCodexSkillsSignatureByWorkspaceRoot.clear();
|
|
652
|
-
}
|
|
653
|
-
onMaintenance(_logger) {
|
|
654
|
-
// No-op for Codex currently.
|
|
655
|
-
// Future: could prune stale thread references, clean temp files, etc.
|
|
656
|
-
}
|
|
657
|
-
// ---------------------------------------------------------------------------
|
|
658
|
-
// Config Management
|
|
659
|
-
// ---------------------------------------------------------------------------
|
|
660
|
-
/**
|
|
661
|
-
* Ensure Codex CLI config.toml is written with the correct provider settings.
|
|
662
|
-
* @param useLiteLLM Whether routing through LiteLLM proxy
|
|
663
|
-
* @param customBaseUrl Custom endpoint URL (undefined for direct OpenAI API)
|
|
664
|
-
* @param modelId Target model ID
|
|
665
|
-
* @param workspaceRoot Workspace root path
|
|
666
|
-
* @param additionalDirectories Additional directories for Codex
|
|
667
|
-
* @param logger Logger for output
|
|
668
|
-
*/
|
|
669
|
-
async ensureCodexConfig(useLiteLLM, customBaseUrl, modelId, workspaceRoot, additionalDirectories, logger, explicitCodexHome, // For pack support
|
|
670
|
-
agentId = 'default', // Active agent ID for skills path
|
|
671
|
-
autoApproveMcp = false) {
|
|
672
|
-
const codexHome = explicitCodexHome ?? this.config.codexHome;
|
|
673
|
-
if (!codexHome) {
|
|
674
|
-
return;
|
|
675
|
-
}
|
|
676
|
-
// Sync project skills into $CODEX_HOME/skills
|
|
677
|
-
try {
|
|
678
|
-
const skillsSig = this.getSkillsSignature(workspaceRoot);
|
|
679
|
-
await this.syncCodexSkillsToCodexHome(codexHome, workspaceRoot, agentId, logger, skillsSig);
|
|
680
|
-
}
|
|
681
|
-
catch (e) {
|
|
682
|
-
logger.warn(`[AgentIDE] Warning: failed to sync skills into $CODEX_HOME: ${e instanceof Error ? e.message : String(e)}`);
|
|
683
|
-
}
|
|
684
|
-
const codexInstructionsFile = await this.updateCodexRuntimeInstructionsFile(codexHome, workspaceRoot, additionalDirectories, agentId, logger);
|
|
685
|
-
// Codex CLI requires wire_api=responses (chat wire was removed in newer Codex releases).
|
|
686
|
-
const wireApi = 'responses';
|
|
687
|
-
const routingType = useLiteLLM ? 'litellm' : (customBaseUrl ? 'custom' : 'openai');
|
|
688
|
-
// No per-turn component in this signature: config.toml must be byte-identical across
|
|
689
|
-
// turns (per-turn auth rides the process env via bearer_token_env_var, never the file),
|
|
690
|
-
// so concurrent same-home turns write identical bytes and the old cross-turn race is
|
|
691
|
-
// gone by construction (secure-obo-design §3.2).
|
|
692
|
-
const signature = `${AGENTIDE_CODEX_CONFIG_VERSION}:${routingType}:${customBaseUrl ?? ''}:${wireApi}:${agentId}:${codexInstructionsFile ?? ''}`;
|
|
693
|
-
if (this.lastWrittenConfigSignature === signature) {
|
|
694
|
-
return;
|
|
695
|
-
}
|
|
696
|
-
await fs_1.promises.mkdir(codexHome, { recursive: true });
|
|
697
|
-
// Build config.toml with common settings and optional custom provider section
|
|
698
|
-
const lines = [
|
|
699
|
-
`# AgentIDE Codex config (generated) - ${routingType} mode`,
|
|
700
|
-
'model_reasoning_summary = "detailed"',
|
|
701
|
-
'hide_agent_reasoning = false',
|
|
702
|
-
// Surface raw reasoning content when the model emits it (improves streaming visibility)
|
|
703
|
-
// 'show_raw_agent_reasoning = true',
|
|
704
|
-
// Force Codex to send reasoning metadata even for unknown models
|
|
705
|
-
// 'model_supports_reasoning_summaries = true',
|
|
706
|
-
// Codex CLI loads a single "model instructions" file that acts like a system/developer prompt overlay.
|
|
707
|
-
// Note: experimental_instructions_file is deprecated and ignored by newer Codex CLI versions.
|
|
708
|
-
codexInstructionsFile ? `model_instructions_file = ${JSON.stringify(codexInstructionsFile)}` : undefined,
|
|
709
|
-
// Inside a TIER-2 sandbox the container is the boundary, so Codex's own sandbox is not
|
|
710
|
-
// just redundant — it cannot start. It shells out to bubblewrap, which needs to create
|
|
711
|
-
// a user namespace and scratch space under /tmp; a container drops those capabilities by
|
|
712
|
-
// design (`--cap-drop ALL`, `no-new-privileges`), so every shell command and file
|
|
713
|
-
// write failed while still reporting exit 0. One boundary, not two — but the tier-0
|
|
714
|
-
// process driver is not a boundary at all, so it never earns this. Keyed on the tier
|
|
715
|
-
// the driver reports, not on merely being inside a sandbox.
|
|
716
|
-
...((0, types_1.isContainerSandbox)()
|
|
717
|
-
? ['sandbox_mode = "danger-full-access"']
|
|
718
|
-
: []),
|
|
719
|
-
];
|
|
720
|
-
// Add custom provider section for LiteLLM or custom providers (e.g., OpenRouter)
|
|
721
|
-
if (customBaseUrl) {
|
|
722
|
-
const providerId = useLiteLLM ? AGENTIDE_CODEX_PROVIDER_ID : AGENTIDE_CODEX_CUSTOM_PROVIDER_ID;
|
|
723
|
-
const providerName = useLiteLLM ? 'AgentIDE LiteLLM' : 'AgentIDE Custom Provider';
|
|
724
|
-
lines.push('', `model_provider = "${providerId}"`, '', `[model_providers.${providerId}]`, `name = "${providerName}"`, `base_url = ${JSON.stringify(customBaseUrl)}`, 'env_key = "CODEX_API_KEY"', `wire_api = "${wireApi}"`, 'query_params = {}');
|
|
725
|
-
// LiteLLM-specific analytics headers (enriched - see PLAN/analytics-design.md)
|
|
726
|
-
if (useLiteLLM) {
|
|
727
|
-
lines.push(`env_http_headers = { ` +
|
|
728
|
-
`"x-litellm-metadata-session-id" = "${AGENTIDE_CODEX_SESSION_ENV_VAR}", ` +
|
|
729
|
-
`"x-litellm-metadata-user-id" = "${AGENTIDE_CODEX_USER_ENV_VAR}", ` +
|
|
730
|
-
`"x-litellm-metadata-project-id" = "${AGENTIDE_CODEX_PROJECT_ID_ENV_VAR}", ` +
|
|
731
|
-
`"langfuse_session_id" = "${AGENTIDE_CODEX_SESSION_ENV_VAR}", ` +
|
|
732
|
-
`"langfuse_trace_user_id" = "${AGENTIDE_CODEX_USER_ENV_VAR}", ` +
|
|
733
|
-
`"x-litellm-metadata-agent-id" = "${AGENTIDE_CODEX_AGENT_ID_ENV_VAR}", ` +
|
|
734
|
-
`"x-litellm-metadata-agent-version" = "${AGENTIDE_CODEX_AGENT_VERSION_ENV_VAR}", ` +
|
|
735
|
-
`"x-litellm-metadata-source" = "${AGENTIDE_CODEX_SOURCE_ENV_VAR}", ` +
|
|
736
|
-
`"x-litellm-metadata-engine" = "${AGENTIDE_CODEX_ENGINE_ENV_VAR}", ` +
|
|
737
|
-
`"x-litellm-metadata-request-id" = "${AGENTIDE_CODEX_REQUEST_ID_ENV_VAR}", ` +
|
|
738
|
-
`"x-litellm-metadata-policy-version" = "${AGENTIDE_CODEX_POLICY_VERSION_ENV_VAR}", ` +
|
|
739
|
-
`"x-litellm-metadata-pack-digest" = "${AGENTIDE_CODEX_PACK_DIGEST_ENV_VAR}", ` +
|
|
740
|
-
`"x-litellm-metadata-engine-version" = "${AGENTIDE_CODEX_ENGINE_VERSION_ENV_VAR}", ` +
|
|
741
|
-
`"x-litellm-metadata-tier" = "${AGENTIDE_CODEX_TIER_ENV_VAR}", ` +
|
|
742
|
-
`"x-litellm-metadata-instance-id" = "${AGENTIDE_CODEX_INSTANCE_ID_ENV_VAR}" }`);
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
// Add MCP servers section (pack-aware)
|
|
746
|
-
const basePromptsDir = this.getBundledBasePromptsDir();
|
|
747
|
-
const servers = await (0, mcp_1.loadMcpServers)(agentId, workspaceRoot, basePromptsDir);
|
|
748
|
-
const mcpSection = (0, mcp_1.generateCodexMcpConfig)(servers, { autoApprove: autoApproveMcp });
|
|
749
|
-
if (servers.length > 0) {
|
|
750
|
-
const source = agentId === 'default' ? 'bundled' : `pack:${agentId}`;
|
|
751
|
-
logger.debug(`[AgentIDE] Codex MCP config (${source}): ${servers.length} server(s)`);
|
|
752
|
-
}
|
|
753
|
-
const configToml = lines.filter(Boolean).join('\n') + mcpSection;
|
|
754
|
-
await fs_1.promises.writeFile(path.join(codexHome, 'config.toml'), configToml, 'utf8');
|
|
755
|
-
this.lastWrittenConfigSignature = signature;
|
|
756
|
-
logger.info(`[AgentIDE] Codex configured (${routingType}) at ${codexHome}${customBaseUrl ? `, baseUrl=${customBaseUrl}, wire_api=${wireApi}` : ''}, model=${modelId ?? 'unknown'}`);
|
|
757
|
-
}
|
|
758
|
-
async updateCodexRuntimeInstructionsFile(codexHome, workspaceRoot, additionalDirectories, agentId, logger) {
|
|
759
|
-
// Read AGENTS.md from the active pack's source directory
|
|
760
|
-
// The source of truth is <BRAND_FOLDER>/agents/<agentId>/AGENTS.md
|
|
761
|
-
const packAgentsFile = path.join(workspaceRoot, agentpack_1.AGENT_CONSTANTS.AGENTIDE_DIR_NAME, 'agents', agentId, 'AGENTS.md');
|
|
762
|
-
let baseRules = '';
|
|
763
|
-
if (await (0, utils_1.pathExists)(packAgentsFile)) {
|
|
764
|
-
baseRules = await fs_1.promises.readFile(packAgentsFile, 'utf8');
|
|
765
|
-
logger.debug(`[AgentIDE] Codex instructions from pack: ${agentId}/AGENTS.md`);
|
|
766
|
-
}
|
|
767
|
-
else {
|
|
768
|
-
// Fall back to bundled templates if pack's AGENTS.md doesn't exist
|
|
769
|
-
const bundledDir = this.getBundledBasePromptsDir();
|
|
770
|
-
if (bundledDir) {
|
|
771
|
-
const bundledAgentsFile = path.join(bundledDir, 'rules', 'AGENTS.md');
|
|
772
|
-
if (await (0, utils_1.pathExists)(bundledAgentsFile)) {
|
|
773
|
-
baseRules = await fs_1.promises.readFile(bundledAgentsFile, 'utf8');
|
|
774
|
-
logger.debug(`[AgentIDE] Codex instructions from bundled templates (pack ${agentId} has no AGENTS.md)`);
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
if (!baseRules) {
|
|
778
|
-
logger.warn(`[AgentIDE] Warning: no AGENTS.md found for agent ${agentId} and no bundled fallback`);
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
// Also read pack's context.md if it exists (combined with AGENTS.md like sync service does)
|
|
782
|
-
const packContextFile = path.join(workspaceRoot, agentpack_1.AGENT_CONSTANTS.AGENTIDE_DIR_NAME, 'agents', agentId, 'context.md');
|
|
783
|
-
let contextContent = '';
|
|
784
|
-
if (await (0, utils_1.pathExists)(packContextFile)) {
|
|
785
|
-
contextContent = await fs_1.promises.readFile(packContextFile, 'utf8');
|
|
786
|
-
}
|
|
787
|
-
const stableDirs = additionalDirectories.slice().filter(Boolean).sort();
|
|
788
|
-
const runtimeContext = {
|
|
789
|
-
workspaceRoot,
|
|
790
|
-
additionalDirectories: stableDirs,
|
|
791
|
-
};
|
|
792
|
-
const runtimeBlock = [
|
|
793
|
-
'## AgentIDE Runtime Context (managed)',
|
|
794
|
-
'',
|
|
795
|
-
'### Workspace Information',
|
|
796
|
-
'',
|
|
797
|
-
'```json',
|
|
798
|
-
JSON.stringify(runtimeContext, null, 2),
|
|
799
|
-
'```',
|
|
800
|
-
].join('\n');
|
|
801
|
-
// Combine: AGENTS.md + context.md + runtime block (mirrors sync service's combined rules format)
|
|
802
|
-
const parts = [baseRules.trimEnd()];
|
|
803
|
-
if (contextContent.trim()) {
|
|
804
|
-
parts.push(contextContent.trimEnd());
|
|
805
|
-
}
|
|
806
|
-
parts.push(runtimeBlock.trimEnd());
|
|
807
|
-
const combined = parts
|
|
808
|
-
.filter(Boolean)
|
|
809
|
-
.join('\n\n---\n\n')
|
|
810
|
-
.trimEnd()
|
|
811
|
-
.concat('\n');
|
|
812
|
-
const runtimeFile = path.join(codexHome, 'agentide.runtime.md');
|
|
813
|
-
await (0, utils_1.writeFileIfChanged)(runtimeFile, combined);
|
|
814
|
-
return runtimeFile;
|
|
815
|
-
}
|
|
816
|
-
async syncCodexSkillsToCodexHome(codexHome, workspaceRoot, agentId, logger, skillsSignature) {
|
|
817
|
-
// Skills are stored under the agent's directory: <BRAND_FOLDER>/agents/<agentId>/skills/
|
|
818
|
-
const srcSkillsRoot = path.join(workspaceRoot, agentpack_1.AGENT_CONSTANTS.AGENTIDE_DIR_NAME, 'agents', agentId, 'skills');
|
|
819
|
-
const dstSkillsRoot = path.join(codexHome, 'skills');
|
|
820
|
-
if (skillsSignature) {
|
|
821
|
-
const last = this.lastCodexSkillsSignatureByWorkspaceRoot.get(workspaceRoot);
|
|
822
|
-
const dstExists = await (0, utils_1.pathExists)(dstSkillsRoot);
|
|
823
|
-
if (last === skillsSignature && dstExists) {
|
|
824
|
-
logger.debug(`[AgentIDE] Codex skills unchanged (sig=${skillsSignature}), skipping $CODEX_HOME sync`);
|
|
825
|
-
return;
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
// Ensure destination is fully overwritten (AgentIDE-managed).
|
|
829
|
-
try {
|
|
830
|
-
await fs_1.promises.rm(dstSkillsRoot, { recursive: true, force: true });
|
|
831
|
-
}
|
|
832
|
-
catch {
|
|
833
|
-
// ignore
|
|
834
|
-
}
|
|
835
|
-
if (!(await (0, utils_1.pathExists)(srcSkillsRoot))) {
|
|
836
|
-
return;
|
|
837
|
-
}
|
|
838
|
-
await fs_1.promises.mkdir(dstSkillsRoot, { recursive: true });
|
|
839
|
-
let copied = 0;
|
|
840
|
-
const entries = await fs_1.promises.readdir(srcSkillsRoot, { withFileTypes: true });
|
|
841
|
-
for (const entry of entries) {
|
|
842
|
-
if (!entry.isDirectory()) {
|
|
843
|
-
continue;
|
|
844
|
-
}
|
|
845
|
-
if (entry.name.startsWith('.')) {
|
|
846
|
-
continue;
|
|
847
|
-
}
|
|
848
|
-
const srcSkill = path.join(srcSkillsRoot, entry.name);
|
|
849
|
-
const skillFile = path.join(srcSkill, 'SKILL.md');
|
|
850
|
-
if (!(await (0, utils_1.pathExists)(skillFile))) {
|
|
851
|
-
continue;
|
|
852
|
-
}
|
|
853
|
-
await (0, utils_1.copyDirRecursive)(srcSkill, path.join(dstSkillsRoot, entry.name));
|
|
854
|
-
copied++;
|
|
855
|
-
}
|
|
856
|
-
if (skillsSignature) {
|
|
857
|
-
this.lastCodexSkillsSignatureByWorkspaceRoot.set(workspaceRoot, skillsSignature);
|
|
858
|
-
}
|
|
859
|
-
logger.info(`[AgentIDE] Codex skills synced to $CODEX_HOME: ${copied} skill(s)`);
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
exports.CodexEngine = CodexEngine;
|