@jsonstudio/rcc 0.89.1189 → 0.89.1348
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/README.md +17 -0
- package/configsamples/config.json +426 -0
- package/configsamples/config.reference.json +58 -0
- package/configsamples/provider/crs/config.v1.json +46 -0
- package/configsamples/provider/glm/config.v1.json +81 -0
- package/configsamples/provider/glm-anthropic/config.v1.json +45 -0
- package/configsamples/provider/iflow/config.v1.json +74 -0
- package/configsamples/provider/kimi/config.v1.json +41 -0
- package/configsamples/provider/lmstudio/config.v1.json +101 -0
- package/configsamples/provider/mimo/config.v1.json +35 -0
- package/configsamples/provider/modelscope/config.v1.json +96 -0
- package/configsamples/provider/qwen/config.v1.json +38 -0
- package/configsamples/provider/tab/config.v1.json +50 -0
- package/configsamples/provider/tabglm/config.v1.json +49 -0
- package/dist/build-info.js +2 -2
- package/dist/cli/commands/code.js +12 -6
- package/dist/cli/commands/code.js.map +1 -1
- package/dist/cli/commands/config.d.ts +2 -1
- package/dist/cli/commands/config.js +74 -103
- package/dist/cli/commands/config.js.map +1 -1
- package/dist/cli/commands/examples.js +6 -6
- package/dist/cli/commands/examples.js.map +1 -1
- package/dist/cli/commands/init.d.ts +28 -0
- package/dist/cli/commands/init.js +91 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/port.js +10 -2
- package/dist/cli/commands/port.js.map +1 -1
- package/dist/cli/commands/restart.js +5 -2
- package/dist/cli/commands/restart.js.map +1 -1
- package/dist/cli/commands/start.js +25 -22
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/status.js +1 -0
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/stop.js +1 -0
- package/dist/cli/commands/stop.js.map +1 -1
- package/dist/cli/config/bundled-docs.d.ts +20 -0
- package/dist/cli/config/bundled-docs.js +91 -0
- package/dist/cli/config/bundled-docs.js.map +1 -0
- package/dist/cli/config/init-config.d.ts +36 -0
- package/dist/cli/config/init-config.js +180 -0
- package/dist/cli/config/init-config.js.map +1 -0
- package/dist/cli/config/init-provider-catalog.d.ts +8 -0
- package/dist/cli/config/init-provider-catalog.js +187 -0
- package/dist/cli/config/init-provider-catalog.js.map +1 -0
- package/dist/cli/register/init-command.d.ts +3 -0
- package/dist/cli/register/init-command.js +5 -0
- package/dist/cli/register/init-command.js.map +1 -0
- package/dist/cli.js +28 -3
- package/dist/cli.js.map +1 -1
- package/dist/client/gemini-cli/gemini-cli-protocol-client.js +1 -1
- package/dist/client/gemini-cli/gemini-cli-protocol-client.js.map +1 -1
- package/dist/config/risk-control-config.d.ts +94 -0
- package/dist/config/risk-control-config.js +196 -0
- package/dist/config/risk-control-config.js.map +1 -0
- package/dist/constants/index.d.ts +6 -0
- package/dist/constants/index.js +13 -0
- package/dist/constants/index.js.map +1 -1
- package/dist/docs/daemon-admin-ui.html +2113 -190
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/manager/modules/health/index.d.ts +1 -1
- package/dist/manager/modules/quota/antigravity-quota-manager.d.ts +70 -0
- package/dist/manager/modules/quota/antigravity-quota-manager.js +442 -0
- package/dist/manager/modules/quota/antigravity-quota-manager.js.map +1 -0
- package/dist/manager/modules/quota/index.d.ts +3 -127
- package/dist/manager/modules/quota/index.js +2 -1093
- package/dist/manager/modules/quota/index.js.map +1 -1
- package/dist/manager/modules/quota/provider-key-normalization.d.ts +3 -0
- package/dist/manager/modules/quota/provider-key-normalization.js +155 -0
- package/dist/manager/modules/quota/provider-key-normalization.js.map +1 -0
- package/dist/manager/modules/quota/provider-quota-daemon.cooldown.d.ts +9 -0
- package/dist/manager/modules/quota/provider-quota-daemon.cooldown.js +115 -0
- package/dist/manager/modules/quota/provider-quota-daemon.cooldown.js.map +1 -0
- package/dist/manager/modules/quota/provider-quota-daemon.d.ts +77 -0
- package/dist/manager/modules/quota/provider-quota-daemon.events.d.ts +12 -0
- package/dist/manager/modules/quota/provider-quota-daemon.events.js +237 -0
- package/dist/manager/modules/quota/provider-quota-daemon.events.js.map +1 -0
- package/dist/manager/modules/quota/provider-quota-daemon.js +404 -0
- package/dist/manager/modules/quota/provider-quota-daemon.js.map +1 -0
- package/dist/manager/modules/quota/provider-quota-daemon.model-backoff.d.ts +11 -0
- package/dist/manager/modules/quota/provider-quota-daemon.model-backoff.js +189 -0
- package/dist/manager/modules/quota/provider-quota-daemon.model-backoff.js.map +1 -0
- package/dist/manager/modules/quota/provider-quota-daemon.snapshot.d.ts +8 -0
- package/dist/manager/modules/quota/provider-quota-daemon.snapshot.js +96 -0
- package/dist/manager/modules/quota/provider-quota-daemon.snapshot.js.map +1 -0
- package/dist/manager/modules/quota/provider-quota-daemon.view.d.ts +19 -0
- package/dist/manager/modules/quota/provider-quota-daemon.view.js +37 -0
- package/dist/manager/modules/quota/provider-quota-daemon.view.js.map +1 -0
- package/dist/manager/modules/routing/index.d.ts +1 -0
- package/dist/manager/modules/routing/index.js +11 -25
- package/dist/manager/modules/routing/index.js.map +1 -1
- package/dist/manager/quota/provider-quota-center.d.ts +2 -0
- package/dist/manager/quota/provider-quota-center.js +80 -82
- package/dist/manager/quota/provider-quota-center.js.map +1 -1
- package/dist/modules/llmswitch/bridge.d.ts +16 -18
- package/dist/modules/llmswitch/bridge.js +314 -71
- package/dist/modules/llmswitch/bridge.js.map +1 -1
- package/dist/modules/llmswitch/core-loader.d.ts +4 -2
- package/dist/modules/llmswitch/core-loader.js +32 -20
- package/dist/modules/llmswitch/core-loader.js.map +1 -1
- package/dist/modules/pipeline/utils/colored-logger.js +3 -2
- package/dist/modules/pipeline/utils/colored-logger.js.map +1 -1
- package/dist/modules/pipeline/utils/debug-logger.js +1 -1
- package/dist/modules/pipeline/utils/debug-logger.js.map +1 -1
- package/dist/providers/auth/iflow-cookie-auth.js +0 -2
- package/dist/providers/auth/iflow-cookie-auth.js.map +1 -1
- package/dist/providers/auth/oauth-lifecycle.js +2 -23
- package/dist/providers/auth/oauth-lifecycle.js.map +1 -1
- package/dist/providers/core/config/camoufox-launcher.js +35 -4
- package/dist/providers/core/config/camoufox-launcher.js.map +1 -1
- package/dist/providers/core/runtime/antigravity-quota-client.js +6 -3
- package/dist/providers/core/runtime/antigravity-quota-client.js.map +1 -1
- package/dist/providers/core/runtime/base-provider.d.ts +2 -2
- package/dist/providers/core/runtime/base-provider.js +74 -69
- package/dist/providers/core/runtime/base-provider.js.map +1 -1
- package/dist/providers/core/runtime/gemini-cli-http-provider.js +6 -4
- package/dist/providers/core/runtime/gemini-cli-http-provider.js.map +1 -1
- package/dist/providers/core/runtime/http-request-executor.js +2 -2
- package/dist/providers/core/runtime/http-request-executor.js.map +1 -1
- package/dist/providers/core/runtime/http-transport-provider.d.ts +14 -0
- package/dist/providers/core/runtime/http-transport-provider.js +111 -5
- package/dist/providers/core/runtime/http-transport-provider.js.map +1 -1
- package/dist/providers/core/runtime/provider-error-classifier.js +10 -0
- package/dist/providers/core/runtime/provider-error-classifier.js.map +1 -1
- package/dist/providers/core/runtime/provider-factory.js +7 -5
- package/dist/providers/core/runtime/provider-factory.js.map +1 -1
- package/dist/providers/core/runtime/provider-runtime-metadata.d.ts +6 -0
- package/dist/providers/core/runtime/provider-runtime-metadata.js.map +1 -1
- package/dist/providers/core/runtime/responses-provider.d.ts +1 -7
- package/dist/providers/core/runtime/responses-provider.js +12 -93
- package/dist/providers/core/runtime/responses-provider.js.map +1 -1
- package/dist/providers/core/strategies/oauth-auth-code-flow.js +12 -8
- package/dist/providers/core/strategies/oauth-auth-code-flow.js.map +1 -1
- package/dist/providers/core/utils/http-client.js +16 -3
- package/dist/providers/core/utils/http-client.js.map +1 -1
- package/dist/providers/core/utils/provider-error-logger.d.ts +1 -1
- package/dist/providers/core/utils/provider-error-reporter.d.ts +3 -1
- package/dist/providers/core/utils/provider-error-reporter.js +3 -0
- package/dist/providers/core/utils/provider-error-reporter.js.map +1 -1
- package/dist/providers/core/utils/snapshot-writer.js +1 -4
- package/dist/providers/core/utils/snapshot-writer.js.map +1 -1
- package/dist/providers/mock/mock-provider-runtime.js +57 -27
- package/dist/providers/mock/mock-provider-runtime.js.map +1 -1
- package/dist/scripts/camoufox/launch-auth.mjs +193 -58
- package/dist/server/handlers/handler-utils.js +3 -2
- package/dist/server/handlers/handler-utils.js.map +1 -1
- package/dist/server/runtime/http-server/daemon-admin/auth-handler.d.ts +2 -0
- package/dist/server/runtime/http-server/daemon-admin/auth-handler.js +103 -0
- package/dist/server/runtime/http-server/daemon-admin/auth-handler.js.map +1 -0
- package/dist/server/runtime/http-server/daemon-admin/auth-session.d.ts +5 -0
- package/dist/server/runtime/http-server/daemon-admin/auth-session.js +77 -0
- package/dist/server/runtime/http-server/daemon-admin/auth-session.js.map +1 -0
- package/dist/server/runtime/http-server/daemon-admin/auth-store.d.ts +18 -0
- package/dist/server/runtime/http-server/daemon-admin/auth-store.js +89 -0
- package/dist/server/runtime/http-server/daemon-admin/auth-store.js.map +1 -0
- package/dist/server/runtime/http-server/daemon-admin/credentials-handler.js +1 -2
- package/dist/server/runtime/http-server/daemon-admin/credentials-handler.js.map +1 -1
- package/dist/server/runtime/http-server/daemon-admin/providers-handler.js +226 -24
- package/dist/server/runtime/http-server/daemon-admin/providers-handler.js.map +1 -1
- package/dist/server/runtime/http-server/daemon-admin/quota-handler.js +47 -8
- package/dist/server/runtime/http-server/daemon-admin/quota-handler.js.map +1 -1
- package/dist/server/runtime/http-server/daemon-admin/restart-handler.js +1 -1
- package/dist/server/runtime/http-server/daemon-admin/restart-handler.js.map +1 -1
- package/dist/server/runtime/http-server/daemon-admin/stats-handler.js +1 -1
- package/dist/server/runtime/http-server/daemon-admin/stats-handler.js.map +1 -1
- package/dist/server/runtime/http-server/daemon-admin/status-handler.js +68 -4
- package/dist/server/runtime/http-server/daemon-admin/status-handler.js.map +1 -1
- package/dist/server/runtime/http-server/daemon-admin-routes.d.ts +3 -4
- package/dist/server/runtime/http-server/daemon-admin-routes.js +9 -14
- package/dist/server/runtime/http-server/daemon-admin-routes.js.map +1 -1
- package/dist/server/runtime/http-server/executor-metadata.js +1 -1
- package/dist/server/runtime/http-server/executor-metadata.js.map +1 -1
- package/dist/server/runtime/http-server/executor-response.js +0 -16
- package/dist/server/runtime/http-server/executor-response.js.map +1 -1
- package/dist/server/runtime/http-server/hub-shadow-compare.d.ts +18 -0
- package/dist/server/runtime/http-server/hub-shadow-compare.js +256 -0
- package/dist/server/runtime/http-server/hub-shadow-compare.js.map +1 -0
- package/dist/server/runtime/http-server/index.d.ts +7 -2
- package/dist/server/runtime/http-server/index.js +287 -49
- package/dist/server/runtime/http-server/index.js.map +1 -1
- package/dist/server/runtime/http-server/middleware.js +19 -1
- package/dist/server/runtime/http-server/middleware.js.map +1 -1
- package/dist/server/runtime/http-server/request-executor.js +10 -19
- package/dist/server/runtime/http-server/request-executor.js.map +1 -1
- package/dist/server/runtime/http-server/routes.js +8 -2
- package/dist/server/runtime/http-server/routes.js.map +1 -1
- package/dist/server/runtime/http-server/session-dir.d.ts +2 -0
- package/dist/server/runtime/http-server/session-dir.js +59 -0
- package/dist/server/runtime/http-server/session-dir.js.map +1 -0
- package/dist/server/runtime/http-server/types.d.ts +0 -4
- package/dist/server/utils/utf8-chunk-buffer.js +6 -3
- package/dist/server/utils/utf8-chunk-buffer.js.map +1 -1
- package/dist/server/utils/warmup-storm-tracker.js +1 -1
- package/dist/server/utils/warmup-storm-tracker.js.map +1 -1
- package/dist/server-factory.d.ts +6 -28
- package/dist/server-factory.js +8 -93
- package/dist/server-factory.js.map +1 -1
- package/dist/token-daemon/index.js +2 -2
- package/dist/token-daemon/index.js.map +1 -1
- package/dist/token-daemon/provider-registry.js +0 -1
- package/dist/token-daemon/provider-registry.js.map +1 -1
- package/dist/token-daemon/server-utils.js +8 -9
- package/dist/token-daemon/server-utils.js.map +1 -1
- package/dist/token-daemon/token-utils.js +1 -1
- package/dist/token-daemon/token-utils.js.map +1 -1
- package/dist/tools/semantic-replay.js +2 -2
- package/dist/tools/semantic-replay.js.map +1 -1
- package/dist/tools/stats-request-events.d.ts +1 -1
- package/dist/tools/stats-usage.js +6 -3
- package/dist/tools/stats-usage.js.map +1 -1
- package/dist/utils/errorsamples.d.ts +5 -0
- package/dist/utils/errorsamples.js +27 -0
- package/dist/utils/errorsamples.js.map +1 -0
- package/dist/utils/llms-engine-shadow.d.ts +19 -0
- package/dist/utils/llms-engine-shadow.js +209 -0
- package/dist/utils/llms-engine-shadow.js.map +1 -0
- package/dist/utils/runtime-versions.d.ts +1 -0
- package/dist/utils/runtime-versions.js +39 -0
- package/dist/utils/runtime-versions.js.map +1 -0
- package/docs/ARCHITECTURE.md +402 -0
- package/docs/CODEX_AND_CLAUDE_CODE.md +69 -0
- package/docs/CONFIG_ARCHITECTURE.md +517 -0
- package/docs/ERROR_HANDLING_AUDIT.md +0 -0
- package/docs/GCLI2API_PARITY_GAPS.md +98 -0
- package/docs/INSTALLATION_AND_QUICKSTART.md +74 -0
- package/docs/INSTRUCTION_MARKUP.md +89 -0
- package/docs/MODULE_ENHANCEMENT_SYSTEM.md +666 -0
- package/docs/PORTS.md +36 -0
- package/docs/PROVIDERS_BUILTIN.md +111 -0
- package/docs/PROVIDER_TYPES.md +55 -0
- package/docs/SERVERTOOL_CLOCK_DESIGN.md +233 -0
- package/docs/USAGE_HANDLING_ANALYSIS.md +335 -0
- package/docs/USER_CONFIG_PARSER_CHANGES.md +175 -0
- package/docs/V3_INBOUND_OUTBOUND_DESIGN.md +86 -0
- package/docs/VIRTUAL_ROUTER_PRIORITY_AND_HEALTH.md +125 -0
- package/docs/anthropic-request-golden-samples.md +50 -0
- package/docs/ccr-alignment-enhancetool.md +105 -0
- package/docs/chat-glm-500-analysis.md +79 -0
- package/docs/chat-request-golden-samples.md +42 -0
- package/docs/chat-semantic-expansion-plan.md +82 -0
- package/docs/cli-command-inventory.md +76 -0
- package/docs/codex-samples-replay.md +50 -0
- package/docs/daemon-admin-api-design.md +350 -0
- package/docs/daemon-admin-module-structure.md +169 -0
- package/docs/daemon-admin-ui.html +3394 -0
- package/docs/debug-system-design.md +734 -0
- package/docs/debugging/gemini-sse-root-cause.md +52 -0
- package/docs/debugging/sse_encoding_failure_analysis.md +53 -0
- package/docs/dry-run/README.md +721 -0
- package/docs/error-handling-v2.md +92 -0
- package/docs/exec-command-guard-policy.example.v1.json +42 -0
- package/docs/fixes/gemini-protocol-mapping.md +57 -0
- package/docs/fixes/oauth-portal-timing-fix.md +202 -0
- package/docs/fixes/web-search-hop3-fix.md +265 -0
- package/docs/glm-api-reference.md +390 -0
- package/docs/glm-chat-completions.md +1779 -0
- package/docs/glm-history-inline-images.md +44 -0
- package/docs/golden-ci-library.md +66 -0
- package/docs/lmstudio-dry-run-summary.md +203 -0
- package/docs/lmstudio-tool-calling.md +214 -0
- package/docs/mapping-tables/anthropic-to-openai.json +290 -0
- package/docs/mapping-tables/iflow-to-openai.json +215 -0
- package/docs/mapping-tables/openai-passthrough.json +190 -0
- package/docs/mapping-tables/openai-to-iflow.json +227 -0
- package/docs/monitoring/Design.md +61 -0
- package/docs/multi-token-auth-guide.md +66 -0
- package/docs/oauth-authentication-guide.md +168 -0
- package/docs/oauth-iflow-implementation.md +153 -0
- package/docs/pipeline-routing-report.md +209 -0
- package/docs/plans/manager-daemon/PLAN.md +86 -0
- package/docs/plans/provider-config-v2-plan.md +176 -0
- package/docs/plans/provider-runtime-manager-plan.md +209 -0
- package/docs/plans/transparent-429-failover.md +89 -0
- package/docs/plans/unified-hub-framework-v1.md +245 -0
- package/docs/provider-config-v2-ui-design.md +181 -0
- package/docs/provider-quota-design.md +129 -0
- package/docs/providers/gemini-provider.md +62 -0
- package/docs/providers/lmstudio-v2-migration-report.md +102 -0
- package/docs/providers/provider-composite-design.md +142 -0
- package/docs/providers/provider-composite-testing.md +98 -0
- package/docs/providers/provider-type-only-migration.md +111 -0
- package/docs/rccx-wasm-migration.md +74 -0
- package/docs/refactoring/architecture-comparison-diagram.md +140 -0
- package/docs/refactoring/compatibility-v2-architecture-design.md +738 -0
- package/docs/refactoring/workflow-compatibility-refactoring-design.md +361 -0
- package/docs/reports/routing-classification-report.json +24 -0
- package/docs/reports/routing-classification-report.md +18 -0
- package/docs/reports/thinking-keywords-report.json +19 -0
- package/docs/responses/README.md +156 -0
- package/docs/responses-generic-provider.md +86 -0
- package/docs/responses-passthrough-provider-design.md +202 -0
- package/docs/routing-awrr-health-weighted-round-robin.md +179 -0
- package/docs/routing-instructions.md +393 -0
- package/docs/stop-message-auto.md +225 -0
- package/docs/streaming-flow.html +30 -0
- package/docs/streaming-flow.md +182 -0
- package/docs/token-daemon-preview.html +490 -0
- package/docs/token-refresh-daemon-plan.md +269 -0
- package/docs/transformation-tables/Gemini-FinishReason/345/256/214/346/225/264/350/275/254/346/215/242/350/241/250.json +233 -0
- package/docs/transformation-tables/README.md +225 -0
- package/docs/transformation-tables/claude-code-router-anthropic-to-gemini.json +283 -0
- package/docs/transformation-tables/claude-code-router-anthropic-to-openai.json +208 -0
- package/docs/transformation-tables/claude-code-router-openai-to-anthropic.json +261 -0
- package/docs/transformation-tables/claude-code-router-openai-to-gemini.json +208 -0
- package/docs/transformation-tables/claude-code-router-openai-to-lmstudio.json +182 -0
- package/docs/transformation-tables/claude-code-router-openai-to-ollama.json +250 -0
- package/docs/transformation-tables/claude-code-router-openai-to-textgenwebui.json +295 -0
- package/docs/transformation-tables/claude-code-router-provider-conversions.json +193 -0
- package/docs/transformation-tables//345/256/214/346/225/264/347/232/204/345/267/245/345/205/267/346/211/247/350/241/214/346/265/201/347/250/213/350/275/254/346/215/242/350/241/250.json +299 -0
- package/docs/transformation-tables//345/257/271/350/257/235/345/216/206/345/217/262/347/273/264/346/212/244/345/210/206/346/236/220.md +134 -0
- package/docs/transformation-tables//345/267/245/345/205/267/350/260/203/347/224/250/346/250/241/345/274/217/345/210/206/346/236/220.md +158 -0
- package/docs/transformation-tables//347/212/266/346/200/201/347/256/241/347/220/206/351/234/200/346/261/202/345/210/206/346/236/220.md +175 -0
- package/docs/transformation-tables//351/235/231/346/200/201/350/241/250vs/345/212/250/346/200/201/345/210/206/346/236/220.md +189 -0
- package/docs/transformation-tables//351/235/231/346/200/201/350/241/250/345/207/206/347/241/256/346/200/247/350/257/204/344/274/260.md +179 -0
- package/docs/transformation-tables//351/235/236/346/265/201/345/274/217/345/234/272/346/231/257/345/210/206/346/236/220.md +189 -0
- package/docs/v2-architecture/IMPLEMENTATION-ROADMAP.md +367 -0
- package/docs/v2-architecture/OPTIMIZED-DESIGN.md +827 -0
- package/docs/v2-architecture/PRERUN-CONNECTION-DESIGN.md +716 -0
- package/docs/v2-architecture/README.md +551 -0
- package/docs/verification/modelscope-verify.md +59 -0
- package/docs/web-search-service-design.md +322 -0
- package/package.json +12 -7
- package/scripts/camoufox/launch-auth.mjs +193 -58
- package/scripts/monitor-diff.mjs +126 -0
- package/scripts/pack-mode.mjs +19 -1
- package/scripts/pack-rcc.mjs +63 -0
- package/scripts/unified-hub-shadow-compare.mjs +33 -13
- package/scripts/verify-e2e-toolcall.mjs +115 -26
- package/dist/modules/llmswitch/pipeline-registry.d.ts +0 -57
- package/dist/modules/llmswitch/pipeline-registry.js +0 -229
- package/dist/modules/llmswitch/pipeline-registry.js.map +0 -1
- package/dist/server/RouteCodexServer.d.ts +0 -13
- package/dist/server/RouteCodexServer.js +0 -25
- package/dist/server/RouteCodexServer.js.map +0 -1
- package/dist/v2/conversion/hub/snapshot-recorder.d.ts +0 -12
- package/dist/v2/conversion/hub/snapshot-recorder.js +0 -22
- package/dist/v2/conversion/hub/snapshot-recorder.js.map +0 -1
|
@@ -0,0 +1,721 @@
|
|
|
1
|
+
# Dry-Run System Documentation
|
|
2
|
+
|
|
3
|
+
The RouteCodex Dry-Run System is a comprehensive debugging and testing framework that enables detailed analysis of pipeline execution without actual processing. It supports node-level dry-run execution, intelligent input simulation, bidirectional pipeline processing, and advanced error recovery mechanisms.
|
|
4
|
+
|
|
5
|
+
## 🏗️ Architecture Overview
|
|
6
|
+
|
|
7
|
+
The dry-run system consists of several interconnected components that work together to provide a complete debugging experience:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
11
|
+
│ Dry-Run System Architecture │
|
|
12
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
13
|
+
│ │
|
|
14
|
+
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
|
|
15
|
+
│ │ Pipeline Dry- │ │ Input │ │ Bidirectional │ │
|
|
16
|
+
│ │ Run Executor │ │ Simulator │ │ Pipeline │ │
|
|
17
|
+
│ │ │ │ │ │ │ │
|
|
18
|
+
│ │ • Node-level │ │ • Mock data │ │ • Request & │ │
|
|
19
|
+
│ │ dry-run │ │ generation │ │ response │ │
|
|
20
|
+
│ │ • Pipeline break │ │ • Context │ │ pipelines │ │
|
|
21
|
+
│ │ • Event │ │ propagation │ │ • Driver │ │
|
|
22
|
+
│ │ handling │ │ • Quality │ │ feedback │ │
|
|
23
|
+
│ │ • Mixed modes │ │ assessment │ │ • Real response │ │
|
|
24
|
+
│ └─────────────────┘ └─────────────────┘ └─────────────────┘ │
|
|
25
|
+
│ │
|
|
26
|
+
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
|
|
27
|
+
│ │ Memory │ │ Error │ │ Pipeline │ │
|
|
28
|
+
│ │ Management │ │ Boundaries │ │ Dry-Run │ │
|
|
29
|
+
│ │ │ │ │ │ Framework │ │
|
|
30
|
+
│ │ • Resource │ │ • Multi-level │ │ • Dry-run │ │
|
|
31
|
+
│ │ tracking │ │ error │ │ configs │ │
|
|
32
|
+
│ │ • Auto cleanup │ │ handling │ │ • Validation │ │
|
|
33
|
+
│ │ • Memory │ │ • Recovery │ │ rules │ │
|
|
34
|
+
│ │ monitoring │ │ strategies │ │ • Performance │ │
|
|
35
|
+
│ │ • Cleanup │ │ • Circuit │ │ estimation │ │
|
|
36
|
+
│ │ strategies │ │ breakers │ │ │ │
|
|
37
|
+
│ └─────────────────┘ └─────────────────┘ └─────────────────┘ │
|
|
38
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 📁 File Structure
|
|
42
|
+
|
|
43
|
+
### Core Framework Files
|
|
44
|
+
|
|
45
|
+
| File | Description | Key Features |
|
|
46
|
+
|------|-------------|--------------|
|
|
47
|
+
| **`pipeline-dry-run-framework.ts`** | Core dry-run framework and interfaces | Node-level configurations, validation rules, error simulation |
|
|
48
|
+
| **`dry-run-pipeline-executor.ts`** | Main pipeline execution engine | Node registration, execution order, event handling, mixed modes |
|
|
49
|
+
| **`input-simulator.ts`** | Intelligent input simulation system | Multiple simulation strategies, context propagation, quality assessment |
|
|
50
|
+
| **`bidirectional-pipeline-dry-run.ts`** | Bidirectional pipeline support | Request/response pipelines, driver feedback, real response integration |
|
|
51
|
+
| **`memory-management.ts`** | Memory and resource management | Resource tracking, cleanup strategies, memory monitoring |
|
|
52
|
+
| **`error-boundaries.ts`** | Error handling and recovery | Multi-level error boundaries, circuit breakers, graceful degradation |
|
|
53
|
+
| **`memory-interface.ts`** | Memory management interfaces | Type definitions, resource interfaces, monitoring interfaces |
|
|
54
|
+
| **`pipeline-dry-run-examples.ts`** | Usage examples and demonstrations | Configuration examples, test scenarios, best practices |
|
|
55
|
+
|
|
56
|
+
### Test Files
|
|
57
|
+
|
|
58
|
+
| File | Description | Test Coverage |
|
|
59
|
+
|------|-------------|---------------|
|
|
60
|
+
| **`test-all-nodes-dry-run.mjs`** | All-nodes dry-run functionality | Input simulation, complete pipeline dry-run |
|
|
61
|
+
| **`test-bidirectional-pipeline-dry-run.mjs`** | Bidirectional pipeline testing | Mixed modes, response sources, feedback analysis |
|
|
62
|
+
|
|
63
|
+
## 🔧 Core Components
|
|
64
|
+
|
|
65
|
+
### 1. Pipeline Dry-Run Framework (`pipeline-dry-run-framework.ts`)
|
|
66
|
+
|
|
67
|
+
**Purpose**: Provides the foundation for node-level dry-run execution with "pipeline break" debugging capabilities.
|
|
68
|
+
|
|
69
|
+
**Key Interfaces**:
|
|
70
|
+
- `NodeDryRunConfig`: Configuration for individual node dry-run behavior
|
|
71
|
+
- `NodeDryRunResult`: Standardized result format for dry-run execution
|
|
72
|
+
- `PipelineDryRunResponse`: Comprehensive response format for pipeline dry-run
|
|
73
|
+
- `OutputValidationRule`: Validation rules for expected outputs
|
|
74
|
+
|
|
75
|
+
**Features**:
|
|
76
|
+
- **Node-Level Configuration**: Each pipeline node can be independently configured for dry-run
|
|
77
|
+
- **Multiple Dry-Run Modes**: Output validation, full analysis, error simulation
|
|
78
|
+
- **Validation Rules**: Comprehensive output validation with customizable rules
|
|
79
|
+
- **Error Simulation**: Controlled error simulation for testing error handling
|
|
80
|
+
- **Performance Estimation**: Detailed performance metrics and estimates
|
|
81
|
+
- **Breakpoint Support**: Debug breakpoints for detailed inspection
|
|
82
|
+
|
|
83
|
+
**Usage Example**:
|
|
84
|
+
```typescript
|
|
85
|
+
import { pipelineDryRunManager, type NodeDryRunConfig } from './src/modules/pipeline/dry-run/pipeline-dry-run-framework.js';
|
|
86
|
+
|
|
87
|
+
const config: NodeDryRunConfig = {
|
|
88
|
+
enabled: true,
|
|
89
|
+
mode: 'full-analysis',
|
|
90
|
+
breakpointBehavior: 'pause',
|
|
91
|
+
verbosity: 'detailed',
|
|
92
|
+
validationRules: [
|
|
93
|
+
{
|
|
94
|
+
id: 'schema-validation',
|
|
95
|
+
type: 'schema',
|
|
96
|
+
condition: { required: ['_metadata'] },
|
|
97
|
+
errorMessage: 'Missing required metadata',
|
|
98
|
+
severity: 'error'
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
pipelineDryRunManager.configureNodeDryRun('llm-switch', config);
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### 2. Dry-Run Pipeline Executor (`dry-run-pipeline-executor.ts`)
|
|
107
|
+
|
|
108
|
+
**Purpose**: Orchestrates the execution of dry-run pipelines with support for mixed execution modes and intelligent input simulation.
|
|
109
|
+
|
|
110
|
+
**Key Classes**:
|
|
111
|
+
- `DryRunPipelineExecutor`: Main execution engine for dry-run pipelines
|
|
112
|
+
- `PipelineNodeInfo`: Node information and configuration
|
|
113
|
+
- `ExecutionContext`: Complete execution context with metadata
|
|
114
|
+
- `BreakpointEvent`: Event system for debugging and monitoring
|
|
115
|
+
|
|
116
|
+
**Features**:
|
|
117
|
+
- **Mixed Execution Modes**: Support for partial dry-run (some nodes normal, some dry-run)
|
|
118
|
+
- **All-Nodes Dry-Run**: Intelligent handling when all nodes are configured for dry-run
|
|
119
|
+
- **Event System**: Comprehensive event handling for debugging
|
|
120
|
+
- **Execution Plans**: Detailed execution plans with time estimates
|
|
121
|
+
- **Breakpoint Handling**: Configurable breakpoint behavior (continue, pause, terminate)
|
|
122
|
+
- **Performance Tracking**: Real-time performance metrics and statistics
|
|
123
|
+
|
|
124
|
+
**Usage Example**:
|
|
125
|
+
```typescript
|
|
126
|
+
import { dryRunPipelineExecutor } from './src/modules/pipeline/dry-run/dry-run-pipeline-executor.js';
|
|
127
|
+
|
|
128
|
+
// Register nodes with mixed dry-run configuration
|
|
129
|
+
dryRunPipelineExecutor.registerNodes([
|
|
130
|
+
{
|
|
131
|
+
id: 'llm-switch',
|
|
132
|
+
type: 'llm-switch',
|
|
133
|
+
module: llmSwitchModule,
|
|
134
|
+
isDryRun: true,
|
|
135
|
+
config: { enabled: true, mode: 'full-analysis' }
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
id: 'provider',
|
|
139
|
+
type: 'provider',
|
|
140
|
+
module: providerModule,
|
|
141
|
+
isDryRun: false // Normal execution
|
|
142
|
+
}
|
|
143
|
+
]);
|
|
144
|
+
|
|
145
|
+
// Execute in mixed mode
|
|
146
|
+
const result = await dryRunPipelineExecutor.executePipeline(
|
|
147
|
+
request,
|
|
148
|
+
'test-pipeline',
|
|
149
|
+
'mixed'
|
|
150
|
+
);
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### 3. Input Simulator (`input-simulator.ts`)
|
|
154
|
+
|
|
155
|
+
**Purpose**: Solves the "all nodes dry-run" problem by generating intelligent mock input data for pipeline execution.
|
|
156
|
+
|
|
157
|
+
**Key Classes**:
|
|
158
|
+
- `InputSimulator`: Main simulation engine with multiple strategies
|
|
159
|
+
- `InputSimulationConfig`: Configuration for simulation behavior
|
|
160
|
+
- `SimulatedInput`: Result of input simulation with quality metrics
|
|
161
|
+
- `ContextPropagationData`: Data propagation context for pipeline simulation
|
|
162
|
+
|
|
163
|
+
**Simulation Strategies**:
|
|
164
|
+
- **Historical Data**: Uses historical request/response data
|
|
165
|
+
- **Schema Inference**: Generates data based on node schema definitions
|
|
166
|
+
- **Rule-Based**: Uses predefined rules and templates
|
|
167
|
+
- **AI Generation**: AI-powered data generation
|
|
168
|
+
- **Request Propagation**: Propagates original request with modifications
|
|
169
|
+
|
|
170
|
+
**Features**:
|
|
171
|
+
- **Multiple Fallback Strategies**: Automatic strategy selection with fallbacks
|
|
172
|
+
- **Quality Assessment**: Quality scoring and confidence metrics
|
|
173
|
+
- **Context Propagation**: Maintains context across pipeline nodes
|
|
174
|
+
- **Performance Estimation**: Time and memory usage estimates
|
|
175
|
+
- **Historical Learning**: Learns from actual execution data
|
|
176
|
+
|
|
177
|
+
**Usage Example**:
|
|
178
|
+
```typescript
|
|
179
|
+
import { inputSimulator } from './src/modules/pipeline/dry-run/input-simulator.js';
|
|
180
|
+
|
|
181
|
+
const simulatedInput = await inputSimulator.simulateInput(
|
|
182
|
+
originalRequest,
|
|
183
|
+
'llm-switch',
|
|
184
|
+
'llm-switch',
|
|
185
|
+
contextData,
|
|
186
|
+
{
|
|
187
|
+
enabled: true,
|
|
188
|
+
primaryStrategy: 'historical-data',
|
|
189
|
+
fallbackStrategies: ['schema-inference', 'rule-based'],
|
|
190
|
+
qualityRequirement: 'medium'
|
|
191
|
+
}
|
|
192
|
+
);
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### 4. Bidirectional Pipeline Dry-Run (`bidirectional-pipeline-dry-run.ts`)
|
|
196
|
+
|
|
197
|
+
**Purpose**: Extends dry-run capabilities to bidirectional pipelines with request/response processing and driver feedback.
|
|
198
|
+
|
|
199
|
+
**Key Classes**:
|
|
200
|
+
- `BidirectionalPipelineManager`: Manages bidirectional pipeline execution
|
|
201
|
+
- `BidirectionalPipelineConfig`: Configuration for bidirectional behavior
|
|
202
|
+
- `ResponseDryRunConfig**: Response-specific dry-run configuration
|
|
203
|
+
- `DriverFeedbackAnalysis**: Comprehensive feedback analysis
|
|
204
|
+
|
|
205
|
+
**Features**:
|
|
206
|
+
- **Bidirectional Processing**: Separate request and response pipeline handling
|
|
207
|
+
- **Real Response Integration**: Use actual server responses as dry-run input
|
|
208
|
+
- **Driver Feedback**: Performance and quality analysis across pipeline stages
|
|
209
|
+
- **Response Input Sources**: Multiple response data sources (real, simulated, cached)
|
|
210
|
+
- **Transformation Rules**: Configurable response transformation and validation
|
|
211
|
+
- **Performance Analytics**: Detailed performance metrics and optimization suggestions
|
|
212
|
+
|
|
213
|
+
**Response Input Sources**:
|
|
214
|
+
- **Real Response**: Use actual server responses
|
|
215
|
+
- **Simulated Response**: AI-generated mock responses
|
|
216
|
+
- **Cached Response**: Use cached historical responses
|
|
217
|
+
|
|
218
|
+
**Usage Example**:
|
|
219
|
+
```typescript
|
|
220
|
+
import { bidirectionalPipelineManager } from './src/modules/pipeline/dry-run/bidirectional-pipeline-dry-run.js';
|
|
221
|
+
|
|
222
|
+
const result = await bidirectionalPipelineManager.executeBidirectionalPipeline(
|
|
223
|
+
request,
|
|
224
|
+
'bidirectional-test',
|
|
225
|
+
realServerResponse
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
console.log('Request result:', result.requestResult);
|
|
229
|
+
console.log('Response result:', result.responseResult);
|
|
230
|
+
console.log('Driver feedback:', result.driverFeedbackAnalysis);
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### 5. Memory Management (`memory-management.ts`)
|
|
234
|
+
|
|
235
|
+
**Purpose**: Provides comprehensive memory management, resource cleanup, and leak prevention for dry-run operations.
|
|
236
|
+
|
|
237
|
+
**Key Classes**:
|
|
238
|
+
- `MemoryManager`: Centralized memory and resource management
|
|
239
|
+
- `ResourceInfo`: Detailed resource tracking information
|
|
240
|
+
- `MemoryStats`: Comprehensive memory usage statistics
|
|
241
|
+
- `CleanupResult**: Results of cleanup operations
|
|
242
|
+
|
|
243
|
+
**Features**:
|
|
244
|
+
- **Resource Tracking**: Automatic registration and tracking of all resources
|
|
245
|
+
- **Multiple Cleanup Strategies**: LRU, LFU, FIFO, TTL, hybrid strategies
|
|
246
|
+
- **Memory Monitoring**: Real-time memory usage monitoring with thresholds
|
|
247
|
+
- **Automatic Cleanup**: Configurable automatic resource cleanup
|
|
248
|
+
- **Performance Optimization**: Memory optimization and leak prevention
|
|
249
|
+
- **Statistics and Reporting**: Detailed memory usage reports and analytics
|
|
250
|
+
|
|
251
|
+
**Cleanup Strategies**:
|
|
252
|
+
- **LRU (Least Recently Used)**: Clean least recently used resources first
|
|
253
|
+
- **LFU (Least Frequently Used)**: Clean least frequently used resources first
|
|
254
|
+
- **FIFO (First In First Out)**: Clean resources in creation order
|
|
255
|
+
- **TTL-Based**: Clean resources based on time-to-live
|
|
256
|
+
- **Size-Based**: Clean largest resources first
|
|
257
|
+
- **Hybrid**: Intelligent combination of multiple strategies
|
|
258
|
+
|
|
259
|
+
**Usage Example**:
|
|
260
|
+
```typescript
|
|
261
|
+
import { memoryManager, ResourceType } from './src/modules/pipeline/dry-run/memory-management.js';
|
|
262
|
+
|
|
263
|
+
// Register a resource for tracking
|
|
264
|
+
memoryManager.registerResource(
|
|
265
|
+
'resource-123',
|
|
266
|
+
ResourceType.EXECUTION_CONTEXT,
|
|
267
|
+
resourceData,
|
|
268
|
+
1024, // Estimated size in bytes
|
|
269
|
+
['execution', 'dry-run'],
|
|
270
|
+
{ pipelineId: 'test-pipeline' }
|
|
271
|
+
);
|
|
272
|
+
|
|
273
|
+
// Get resource with automatic access tracking
|
|
274
|
+
const resource = memoryManager.getResource('resource-123');
|
|
275
|
+
|
|
276
|
+
// Manual cleanup
|
|
277
|
+
const cleanupResult = await memoryManager.cleanup();
|
|
278
|
+
console.log(`Freed ${cleanupResult.freedMemory} bytes`);
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### 6. Error Boundaries (`error-boundaries.ts`)
|
|
282
|
+
|
|
283
|
+
**Purpose**: Provides comprehensive error handling, recovery mechanisms, and fault tolerance for dry-run operations.
|
|
284
|
+
|
|
285
|
+
**Key Classes**:
|
|
286
|
+
- `ErrorBoundaryManager`: Centralized error boundary management
|
|
287
|
+
- `ErrorBoundary`: Individual error boundary for protected operations
|
|
288
|
+
- `SystemError**: Standardized error representation
|
|
289
|
+
- `CircuitBreakerState**: Circuit breaker state management
|
|
290
|
+
|
|
291
|
+
**Features**:
|
|
292
|
+
- **Multi-Level Error Handling**: Global and local error boundaries
|
|
293
|
+
- **Intelligent Recovery Strategies**: Automatic recovery with multiple strategies
|
|
294
|
+
- **Circuit Breaker Pattern**: Prevents cascading failures
|
|
295
|
+
- **Graceful Degradation**: Maintains system availability during errors
|
|
296
|
+
- **Error Isolation**: Contains errors within boundaries
|
|
297
|
+
- **Comprehensive Statistics**: Detailed error tracking and analysis
|
|
298
|
+
|
|
299
|
+
**Recovery Strategies**:
|
|
300
|
+
- **Retry Immediate**: Immediate retry for transient errors
|
|
301
|
+
- **Retry Delayed**: Delayed retry with configurable delays
|
|
302
|
+
- **Retry Exponential**: Exponential backoff for persistent errors
|
|
303
|
+
- **Fallback Primary/Secondary**: Fallback to alternative implementations
|
|
304
|
+
- **Circuit Breaker**: Temporarily stop operations on repeated failures
|
|
305
|
+
- **Graceful Degradation**: Degrade functionality gracefully
|
|
306
|
+
- **Skip Operation**: Skip non-critical operations
|
|
307
|
+
- **Terminate**: Stop operations on critical errors
|
|
308
|
+
|
|
309
|
+
**Usage Example**:
|
|
310
|
+
```typescript
|
|
311
|
+
import { errorBoundaryManager, defaultErrorBoundaryConfig } from './src/modules/pipeline/dry-run/error-boundaries.js';
|
|
312
|
+
|
|
313
|
+
// Create an error boundary
|
|
314
|
+
const boundary = errorBoundaryManager.createBoundary({
|
|
315
|
+
...defaultErrorBoundaryConfig,
|
|
316
|
+
boundaryId: 'dry-run-boundary',
|
|
317
|
+
maxRetries: 3,
|
|
318
|
+
enableCircuitBreaker: true,
|
|
319
|
+
enableGracefulDegradation: true
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
// Execute protected operation
|
|
323
|
+
const result = await boundary.execute(
|
|
324
|
+
async () => {
|
|
325
|
+
// Your dry-run operation here
|
|
326
|
+
return await performDryRunOperation();
|
|
327
|
+
},
|
|
328
|
+
async () => {
|
|
329
|
+
// Fallback operation
|
|
330
|
+
return await performFallbackOperation();
|
|
331
|
+
}
|
|
332
|
+
);
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### 7. Memory Interface (`memory-interface.ts`)
|
|
336
|
+
|
|
337
|
+
**Purpose**: Defines comprehensive interfaces for memory management, resource handling, and system monitoring.
|
|
338
|
+
|
|
339
|
+
**Key Interfaces**:
|
|
340
|
+
- `Disposable`: Standard interface for disposable resources
|
|
341
|
+
- `ResourceUsage`: System resource usage information
|
|
342
|
+
- `MemoryEvent`: Memory-related event data
|
|
343
|
+
- `MemoryAnalyzer`: Memory analysis and leak detection
|
|
344
|
+
- `MemoryMonitor`: Real-time memory monitoring
|
|
345
|
+
- `ResourcePool`: Resource pooling interface
|
|
346
|
+
|
|
347
|
+
**Features**:
|
|
348
|
+
- **Type Safety**: Comprehensive TypeScript type definitions
|
|
349
|
+
- **Extensibility**: Well-defined interfaces for extension
|
|
350
|
+
- **Monitoring**: Standardized monitoring capabilities
|
|
351
|
+
- **Analysis**: Memory analysis and leak detection interfaces
|
|
352
|
+
- **Resource Management**: Standardized resource lifecycle management
|
|
353
|
+
|
|
354
|
+
## 🚀 Usage Patterns
|
|
355
|
+
|
|
356
|
+
### 1. Basic Node-Level Dry-Run
|
|
357
|
+
|
|
358
|
+
```typescript
|
|
359
|
+
// Configure individual nodes for dry-run
|
|
360
|
+
pipelineDryRunManager.configureNodesDryRun({
|
|
361
|
+
'llm-switch': {
|
|
362
|
+
enabled: true,
|
|
363
|
+
mode: 'output-validation',
|
|
364
|
+
breakpointBehavior: 'continue',
|
|
365
|
+
verbosity: 'normal'
|
|
366
|
+
},
|
|
367
|
+
'compatibility': {
|
|
368
|
+
enabled: true,
|
|
369
|
+
mode: 'full-analysis',
|
|
370
|
+
breakpointBehavior: 'pause',
|
|
371
|
+
verbosity: 'detailed'
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
// Execute with mixed modes
|
|
376
|
+
const result = await dryRunPipelineExecutor.executePipeline(
|
|
377
|
+
request,
|
|
378
|
+
'test-pipeline',
|
|
379
|
+
'mixed'
|
|
380
|
+
);
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
### 2. All-Nodes Dry-Run with Input Simulation
|
|
384
|
+
|
|
385
|
+
```typescript
|
|
386
|
+
// Configure all nodes for dry-run
|
|
387
|
+
const allNodesConfig = {
|
|
388
|
+
'llm-switch': { enabled: true, mode: 'full-analysis' },
|
|
389
|
+
'compatibility': { enabled: true, mode: 'full-analysis' },
|
|
390
|
+
'provider': { enabled: true, mode: 'full-analysis' }
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
pipelineDryRunManager.configureNodesDryRun(allNodesConfig);
|
|
394
|
+
|
|
395
|
+
// Execute - input simulator will automatically generate mock data
|
|
396
|
+
const result = await dryRunPipelineExecutor.executePipeline(
|
|
397
|
+
request,
|
|
398
|
+
'all-nodes-test',
|
|
399
|
+
'dry-run'
|
|
400
|
+
);
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### 3. Bidirectional Pipeline Dry-Run
|
|
404
|
+
|
|
405
|
+
```typescript
|
|
406
|
+
// Configure bidirectional pipeline
|
|
407
|
+
const bidirectionalConfig = {
|
|
408
|
+
requestConfig: {
|
|
409
|
+
dryRunMode: 'full',
|
|
410
|
+
nodeConfigs: {
|
|
411
|
+
'llm-switch': { enabled: true, mode: 'full-analysis' },
|
|
412
|
+
'compatibility': { enabled: false, mode: 'output-validation' }
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
responseConfig: {
|
|
416
|
+
dryRunMode: 'partial',
|
|
417
|
+
responseDryRun: {
|
|
418
|
+
enabled: true,
|
|
419
|
+
inputSource: 'real-response',
|
|
420
|
+
performanceAnalysis: true
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
driverFeedback: {
|
|
424
|
+
enabled: true,
|
|
425
|
+
analysisLevel: 'detailed'
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
|
|
429
|
+
const result = await bidirectionalPipelineManager.executeBidirectionalPipeline(
|
|
430
|
+
request,
|
|
431
|
+
'bidirectional-test',
|
|
432
|
+
realServerResponse
|
|
433
|
+
);
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
### 4. Memory Management Integration
|
|
437
|
+
|
|
438
|
+
```typescript
|
|
439
|
+
// Register resources for automatic cleanup
|
|
440
|
+
memoryManager.registerResource(
|
|
441
|
+
'dry-run-context',
|
|
442
|
+
ResourceType.EXECUTION_CONTEXT,
|
|
443
|
+
contextData,
|
|
444
|
+
2048,
|
|
445
|
+
['dry-run', 'execution'],
|
|
446
|
+
{ pipelineId: 'test-pipeline' }
|
|
447
|
+
);
|
|
448
|
+
|
|
449
|
+
// Execute with memory monitoring
|
|
450
|
+
const stats = memoryManager.getStats();
|
|
451
|
+
console.log(`Memory usage: ${stats.totalUsage} bytes (${(stats.memoryUsageRatio * 100).toFixed(1)}%)`);
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
### 5. Error Boundary Protection
|
|
455
|
+
|
|
456
|
+
```typescript
|
|
457
|
+
// Create protected execution boundary
|
|
458
|
+
const boundary = errorBoundaryManager.createBoundary({
|
|
459
|
+
boundaryId: 'dry-run-protection',
|
|
460
|
+
maxRetries: 3,
|
|
461
|
+
enableCircuitBreaker: true,
|
|
462
|
+
enableGracefulDegradation: true
|
|
463
|
+
});
|
|
464
|
+
|
|
465
|
+
// Execute with error protection
|
|
466
|
+
const result = await boundary.execute(
|
|
467
|
+
async () => {
|
|
468
|
+
return await performComplexDryRunOperation();
|
|
469
|
+
},
|
|
470
|
+
async () => {
|
|
471
|
+
return await performGracefulFallback();
|
|
472
|
+
}
|
|
473
|
+
);
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
## 🧪 Testing
|
|
477
|
+
|
|
478
|
+
### Running Tests
|
|
479
|
+
|
|
480
|
+
```bash
|
|
481
|
+
# Test all-nodes dry-run functionality
|
|
482
|
+
node test-all-nodes-dry-run.mjs
|
|
483
|
+
|
|
484
|
+
# Test bidirectional pipeline dry-run
|
|
485
|
+
node test-bidirectional-pipeline-dry-run.mjs
|
|
486
|
+
|
|
487
|
+
# Run with specific configurations
|
|
488
|
+
node test-all-nodes-dry-run.mjs --mode=full-analysis
|
|
489
|
+
node test-bidirectional-pipeline-dry-run.mjs --response-source=real-response
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
### Test Coverage
|
|
493
|
+
|
|
494
|
+
The test suite covers:
|
|
495
|
+
|
|
496
|
+
- **All-Nodes Dry-Run**: Input simulation, context propagation, complete pipeline analysis
|
|
497
|
+
- **Mixed Execution Modes**: Partial dry-run with normal execution nodes
|
|
498
|
+
- **Bidirectional Processing**: Request/response pipeline coordination
|
|
499
|
+
- **Response Input Sources**: Real, simulated, and cached response handling
|
|
500
|
+
- **Driver Feedback Analysis**: Performance and quality analytics
|
|
501
|
+
- **Memory Management**: Resource tracking, cleanup strategies, leak prevention
|
|
502
|
+
- **Error Boundaries**: Error handling, recovery mechanisms, circuit breakers
|
|
503
|
+
- **Performance Monitoring**: Memory usage, execution time, resource optimization
|
|
504
|
+
|
|
505
|
+
## 🔧 Configuration
|
|
506
|
+
|
|
507
|
+
### Dry-Run Configuration Structure
|
|
508
|
+
|
|
509
|
+
```json
|
|
510
|
+
{
|
|
511
|
+
"dryRun": {
|
|
512
|
+
"global": {
|
|
513
|
+
"enabled": true,
|
|
514
|
+
"defaultMode": "output-validation",
|
|
515
|
+
"verbosity": "normal",
|
|
516
|
+
"autoCleanup": true
|
|
517
|
+
},
|
|
518
|
+
"nodes": {
|
|
519
|
+
"llm-switch": {
|
|
520
|
+
"enabled": true,
|
|
521
|
+
"mode": "full-analysis",
|
|
522
|
+
"breakpointBehavior": "continue",
|
|
523
|
+
"validationRules": [...],
|
|
524
|
+
"errorSimulation": {...}
|
|
525
|
+
},
|
|
526
|
+
"compatibility": {
|
|
527
|
+
"enabled": false,
|
|
528
|
+
"mode": "output-validation"
|
|
529
|
+
}
|
|
530
|
+
},
|
|
531
|
+
"inputSimulation": {
|
|
532
|
+
"enabled": true,
|
|
533
|
+
"primaryStrategy": "historical-data",
|
|
534
|
+
"fallbackStrategies": ["schema-inference", "rule-based"],
|
|
535
|
+
"qualityRequirement": "medium"
|
|
536
|
+
},
|
|
537
|
+
"memory": {
|
|
538
|
+
"maxMemoryUsage": 536870912,
|
|
539
|
+
"cleanupInterval": 60000,
|
|
540
|
+
"enableMonitoring": true,
|
|
541
|
+
"cleanupStrategy": "hybrid"
|
|
542
|
+
},
|
|
543
|
+
"errorHandling": {
|
|
544
|
+
"maxRetries": 3,
|
|
545
|
+
"enableCircuitBreaker": true,
|
|
546
|
+
"enableGracefulDegradation": true
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
## 📊 Monitoring and Analytics
|
|
553
|
+
|
|
554
|
+
### Memory Usage Monitoring
|
|
555
|
+
|
|
556
|
+
```typescript
|
|
557
|
+
// Get current memory statistics
|
|
558
|
+
const stats = memoryManager.getStats();
|
|
559
|
+
console.log(`Memory Usage: ${stats.totalUsage} bytes`);
|
|
560
|
+
console.log(`Active Resources: ${stats.activeResources}`);
|
|
561
|
+
console.log(`Cache Hit Rate: ${stats.cacheHitRate}`);
|
|
562
|
+
|
|
563
|
+
// Set up memory monitoring callbacks
|
|
564
|
+
memoryManager.setCallbacks({
|
|
565
|
+
onMemoryWarning: (stats) => {
|
|
566
|
+
console.warn(`Memory usage warning: ${(stats.memoryUsageRatio * 100).toFixed(1)}%`);
|
|
567
|
+
},
|
|
568
|
+
onMemoryCritical: (stats) => {
|
|
569
|
+
console.error(`Memory usage critical: ${(stats.memoryUsageRatio * 100).toFixed(1)}%`);
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
### Error Analytics
|
|
575
|
+
|
|
576
|
+
```typescript
|
|
577
|
+
// Get error statistics
|
|
578
|
+
const errorStats = errorBoundaryManager.getStats();
|
|
579
|
+
console.log(`Total Errors: ${errorStats.totalErrors}`);
|
|
580
|
+
console.log(`Successful Recoveries: ${errorStats.successfulRecoveries}`);
|
|
581
|
+
console.log(`Average Recovery Time: ${errorStats.averageRecoveryTime}ms`);
|
|
582
|
+
|
|
583
|
+
// Get active errors
|
|
584
|
+
const activeErrors = errorBoundaryManager.getActiveErrors();
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
### Performance Analytics
|
|
588
|
+
|
|
589
|
+
```typescript
|
|
590
|
+
// Driver feedback analysis provides detailed performance metrics
|
|
591
|
+
if (result.driverFeedbackAnalysis) {
|
|
592
|
+
const analysis = result.driverFeedbackAnalysis;
|
|
593
|
+
console.log(`Request-Response Correlation: ${analysis.requestResponseCorrelation.similarity}`);
|
|
594
|
+
console.log(`Total Processing Time: ${analysis.performanceAnalysis.totalOverhead}ms`);
|
|
595
|
+
console.log(`Overall Quality Score: ${analysis.qualityAnalysis.overallQuality}`);
|
|
596
|
+
}
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
## 🎯 Best Practices
|
|
600
|
+
|
|
601
|
+
### 1. Configuration Management
|
|
602
|
+
- Use consistent configuration across all dry-run nodes
|
|
603
|
+
- Configure appropriate verbosity levels for different environments
|
|
604
|
+
- Enable memory monitoring in production environments
|
|
605
|
+
|
|
606
|
+
### 2. Memory Management
|
|
607
|
+
- Always register resources with the memory manager
|
|
608
|
+
- Use appropriate cleanup strategies for your use case
|
|
609
|
+
- Monitor memory usage and set appropriate thresholds
|
|
610
|
+
|
|
611
|
+
### 3. Error Handling
|
|
612
|
+
- Create appropriate error boundaries for critical operations
|
|
613
|
+
- Configure sensible retry strategies for different error types
|
|
614
|
+
- Enable graceful degradation for non-critical operations
|
|
615
|
+
|
|
616
|
+
### 4. Performance Optimization
|
|
617
|
+
- Use input simulation for all-nodes dry-run scenarios
|
|
618
|
+
- Leverage caching for frequently used response data
|
|
619
|
+
- Monitor performance metrics and optimize accordingly
|
|
620
|
+
|
|
621
|
+
### 5. Testing Strategy
|
|
622
|
+
- Test both individual nodes and complete pipelines
|
|
623
|
+
- Validate mixed execution modes thoroughly
|
|
624
|
+
- Test error scenarios and recovery mechanisms
|
|
625
|
+
|
|
626
|
+
## 🔍 Troubleshooting
|
|
627
|
+
|
|
628
|
+
### Common Issues
|
|
629
|
+
|
|
630
|
+
**Memory Leaks**
|
|
631
|
+
- Ensure all resources are properly registered with memory manager
|
|
632
|
+
- Check for missing cleanup operations
|
|
633
|
+
- Monitor memory usage trends over time
|
|
634
|
+
|
|
635
|
+
**Slow Performance**
|
|
636
|
+
- Optimize input simulation strategies
|
|
637
|
+
- Use caching for frequently accessed data
|
|
638
|
+
- Adjust cleanup intervals based on load
|
|
639
|
+
|
|
640
|
+
**Error Recovery Failures**
|
|
641
|
+
- Verify error boundary configurations
|
|
642
|
+
- Check fallback operation implementations
|
|
643
|
+
- Monitor circuit breaker states
|
|
644
|
+
|
|
645
|
+
**Input Simulation Issues**
|
|
646
|
+
- Validate simulation strategy configurations
|
|
647
|
+
- Check historical data availability
|
|
648
|
+
- Ensure appropriate fallback strategies are configured
|
|
649
|
+
|
|
650
|
+
### Debug Tools
|
|
651
|
+
|
|
652
|
+
```typescript
|
|
653
|
+
// Enable detailed logging
|
|
654
|
+
console.log('Memory Stats:', memoryManager.getStats());
|
|
655
|
+
console.log('Error Stats:', errorBoundaryManager.getStats());
|
|
656
|
+
|
|
657
|
+
// Get detailed resource information
|
|
658
|
+
const resources = memoryManager.getAllResources();
|
|
659
|
+
resources.forEach(resource => {
|
|
660
|
+
console.log(`${resource.id}: ${resource.estimatedSize} bytes`);
|
|
661
|
+
});
|
|
662
|
+
|
|
663
|
+
// Check circuit breaker states
|
|
664
|
+
dryRunPipelineExecutor.getRegisteredNodes().forEach(node => {
|
|
665
|
+
const boundary = errorBoundaryManager.getBoundary(node.id);
|
|
666
|
+
if (boundary) {
|
|
667
|
+
console.log(`${node.id} circuit breaker:`, boundary.getCircuitBreakerState());
|
|
668
|
+
}
|
|
669
|
+
});
|
|
670
|
+
```
|
|
671
|
+
|
|
672
|
+
## 📈 Advanced Features
|
|
673
|
+
|
|
674
|
+
### Custom Simulation Strategies
|
|
675
|
+
|
|
676
|
+
```typescript
|
|
677
|
+
// Add custom simulation strategy
|
|
678
|
+
inputSimulator.addStrategy('custom-strategy', async (input, context) => {
|
|
679
|
+
// Custom simulation logic
|
|
680
|
+
return {
|
|
681
|
+
source: 'custom',
|
|
682
|
+
data: customGenerateData(input, context),
|
|
683
|
+
quality: 0.9,
|
|
684
|
+
confidence: 0.85,
|
|
685
|
+
strategy: 'custom-strategy',
|
|
686
|
+
metadata: { /* Custom metadata */ }
|
|
687
|
+
};
|
|
688
|
+
});
|
|
689
|
+
```
|
|
690
|
+
|
|
691
|
+
### Custom Error Handlers
|
|
692
|
+
|
|
693
|
+
```typescript
|
|
694
|
+
// Add custom error handlers
|
|
695
|
+
const boundary = errorBoundaryManager.createBoundary({
|
|
696
|
+
...defaultErrorBoundaryConfig,
|
|
697
|
+
customHandlers: {
|
|
698
|
+
[ErrorType.NETWORK_ERROR]: async (error) => {
|
|
699
|
+
// Custom network error handling
|
|
700
|
+
return await handleNetworkError(error);
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
});
|
|
704
|
+
```
|
|
705
|
+
|
|
706
|
+
### Custom Recovery Strategies
|
|
707
|
+
|
|
708
|
+
```typescript
|
|
709
|
+
// Implement custom recovery logic
|
|
710
|
+
const customRecovery = async (error: SystemError) => {
|
|
711
|
+
// Custom recovery logic
|
|
712
|
+
return {
|
|
713
|
+
success: true,
|
|
714
|
+
resolved: true,
|
|
715
|
+
action: 'custom-recovery',
|
|
716
|
+
result: await performCustomRecovery(error)
|
|
717
|
+
};
|
|
718
|
+
};
|
|
719
|
+
```
|
|
720
|
+
|
|
721
|
+
This comprehensive dry-run system provides powerful debugging and testing capabilities for the RouteCodex pipeline, enabling detailed analysis, performance optimization, and reliable error handling across all execution scenarios.
|