@jsonstudio/rcc 0.89.2239 → 0.90.89
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 +27 -0
- package/dist/build-info.js +2 -2
- package/dist/build-info.js.map +1 -1
- package/dist/cli/commands/claude.js +4 -8
- package/dist/cli/commands/claude.js.map +1 -1
- package/dist/cli/commands/codex.js +6 -3
- package/dist/cli/commands/codex.js.map +1 -1
- package/dist/cli/commands/guardian-daemon.d.ts +2 -0
- package/dist/cli/commands/guardian-daemon.js +299 -0
- package/dist/cli/commands/guardian-daemon.js.map +1 -0
- package/dist/cli/commands/init/camoufox.js +1 -1
- package/dist/cli/commands/init/camoufox.js.map +1 -1
- package/dist/cli/commands/launcher/index.d.ts +1 -1
- package/dist/cli/commands/launcher/types.d.ts +7 -1
- package/dist/cli/commands/launcher/utils.d.ts +4 -1
- package/dist/cli/commands/launcher/utils.js +18 -8
- package/dist/cli/commands/launcher/utils.js.map +1 -1
- package/dist/cli/commands/launcher-kernel.d.ts +1 -1
- package/dist/cli/commands/launcher-kernel.js +608 -249
- package/dist/cli/commands/launcher-kernel.js.map +1 -1
- package/dist/cli/commands/port.js +28 -8
- package/dist/cli/commands/port.js.map +1 -1
- package/dist/cli/commands/restart.d.ts +4 -0
- package/dist/cli/commands/restart.js +91 -42
- package/dist/cli/commands/restart.js.map +1 -1
- package/dist/cli/commands/{clock-admin.d.ts → session-admin.d.ts} +2 -2
- package/dist/cli/commands/{clock-admin.js → session-admin.js} +17 -17
- package/dist/cli/commands/session-admin.js.map +1 -0
- package/dist/cli/commands/{tmux-inject.d.ts → session-inject.d.ts} +2 -2
- package/dist/cli/commands/{tmux-inject.js → session-inject.js} +12 -12
- package/dist/cli/commands/session-inject.js.map +1 -0
- package/dist/cli/commands/start-types.d.ts +4 -0
- package/dist/cli/commands/start-utils.d.ts +1 -0
- package/dist/cli/commands/start-utils.js +3 -0
- package/dist/cli/commands/start-utils.js.map +1 -1
- package/dist/cli/commands/start.js +122 -72
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/stop.d.ts +3 -0
- package/dist/cli/commands/stop.js +30 -63
- package/dist/cli/commands/stop.js.map +1 -1
- package/dist/cli/config/init-provider-catalog.js +8 -3
- package/dist/cli/config/init-provider-catalog.js.map +1 -1
- package/dist/cli/guardian/client.d.ts +38 -0
- package/dist/cli/guardian/client.js +237 -0
- package/dist/cli/guardian/client.js.map +1 -0
- package/dist/cli/guardian/paths.d.ts +7 -0
- package/dist/cli/guardian/paths.js +13 -0
- package/dist/cli/guardian/paths.js.map +1 -0
- package/dist/cli/guardian/types.d.ts +30 -0
- package/dist/cli/guardian/types.js +2 -0
- package/dist/cli/guardian/types.js.map +1 -0
- package/dist/cli/register/guardian-daemon-command.d.ts +2 -0
- package/dist/cli/register/guardian-daemon-command.js +5 -0
- package/dist/cli/register/guardian-daemon-command.js.map +1 -0
- package/dist/cli/register/session-admin-command.d.ts +3 -0
- package/dist/cli/register/session-admin-command.js +5 -0
- package/dist/cli/register/session-admin-command.js.map +1 -0
- package/dist/cli/register/session-inject-command.d.ts +3 -0
- package/dist/cli/register/session-inject-command.js +5 -0
- package/dist/cli/register/session-inject-command.js.map +1 -0
- package/dist/cli/server/port-utils.js +57 -1
- package/dist/cli/server/port-utils.js.map +1 -1
- package/dist/cli.js +52 -4
- package/dist/cli.js.map +1 -1
- package/dist/commands/oauth.js +6 -6
- package/dist/commands/oauth.js.map +1 -1
- package/dist/config/provider-v2-loader.js +18 -3
- package/dist/config/provider-v2-loader.js.map +1 -1
- package/dist/config/routecodex-config-loader.js +184 -9
- package/dist/config/routecodex-config-loader.js.map +1 -1
- package/dist/config/unified-config-paths.js +22 -0
- package/dist/config/unified-config-paths.js.map +1 -1
- package/dist/config/virtual-router-builder.js +18 -5
- package/dist/config/virtual-router-builder.js.map +1 -1
- package/dist/config/virtual-router-types.js +20 -5
- package/dist/config/virtual-router-types.js.map +1 -1
- package/dist/daemon-admin-ui/assets/index-C8vP_c5E.js +15 -0
- package/dist/daemon-admin-ui/assets/index-DjIoHmNv.css +1 -0
- package/dist/daemon-admin-ui/index.html +13 -0
- package/dist/docs/daemon-admin-ui.html +334 -63
- package/dist/index.d.ts +9 -0
- package/dist/index.js +268 -10
- package/dist/index.js.map +1 -1
- package/dist/manager/modules/quota/provider-key-normalization.js +1 -10
- package/dist/manager/modules/quota/provider-key-normalization.js.map +1 -1
- package/dist/manager/modules/quota/provider-quota-daemon.error-helpers.d.ts +1 -0
- package/dist/manager/modules/quota/provider-quota-daemon.error-helpers.js +36 -0
- package/dist/manager/modules/quota/provider-quota-daemon.error-helpers.js.map +1 -1
- package/dist/manager/modules/quota/provider-quota-daemon.events.js +89 -49
- package/dist/manager/modules/quota/provider-quota-daemon.events.js.map +1 -1
- package/dist/manager/modules/quota/provider-quota-daemon.model-backoff.js +2 -16
- package/dist/manager/modules/quota/provider-quota-daemon.model-backoff.js.map +1 -1
- package/dist/manager/modules/token/index.d.ts +1 -0
- package/dist/manager/modules/token/index.js +6 -1
- package/dist/manager/modules/token/index.js.map +1 -1
- package/dist/manager/types.d.ts +1 -0
- package/dist/modules/llmswitch/bridge/state-integrations.js +1 -1
- package/dist/modules/llmswitch/bridge/state-integrations.js.map +1 -1
- package/dist/providers/auth/antigravity-user-agent.js +78 -31
- package/dist/providers/auth/antigravity-user-agent.js.map +1 -1
- package/dist/providers/auth/gemini-cli-userinfo-helper.js +94 -63
- package/dist/providers/auth/gemini-cli-userinfo-helper.js.map +1 -1
- package/dist/providers/auth/iflow-userinfo-helper.js +1 -1
- package/dist/providers/auth/iflow-userinfo-helper.js.map +1 -1
- package/dist/providers/auth/oauth-error-message.d.ts +1 -0
- package/dist/providers/auth/oauth-error-message.js +44 -0
- package/dist/providers/auth/oauth-error-message.js.map +1 -0
- package/dist/providers/auth/oauth-lifecycle/error-detection.js +42 -8
- package/dist/providers/auth/oauth-lifecycle/error-detection.js.map +1 -1
- package/dist/providers/auth/oauth-lifecycle/token-io.d.ts +1 -0
- package/dist/providers/auth/oauth-lifecycle/token-io.js +12 -0
- package/dist/providers/auth/oauth-lifecycle/token-io.js.map +1 -1
- package/dist/providers/auth/oauth-lifecycle.js +502 -87
- package/dist/providers/auth/oauth-lifecycle.js.map +1 -1
- package/dist/providers/auth/oauth-repair-env.js +3 -5
- package/dist/providers/auth/oauth-repair-env.js.map +1 -1
- package/dist/providers/auth/oauth-utils/error-extraction.js +42 -8
- package/dist/providers/auth/oauth-utils/error-extraction.js.map +1 -1
- package/dist/providers/core/config/camoufox-actions.d.ts +31 -0
- package/dist/providers/core/config/camoufox-actions.js +470 -0
- package/dist/providers/core/config/camoufox-actions.js.map +1 -0
- package/dist/providers/core/config/camoufox-launcher.d.ts +3 -0
- package/dist/providers/core/config/camoufox-launcher.js +553 -159
- package/dist/providers/core/config/camoufox-launcher.js.map +1 -1
- package/dist/providers/core/config/oauth-flows.js +6 -44
- package/dist/providers/core/config/oauth-flows.js.map +1 -1
- package/dist/providers/core/config/provider-oauth-configs.js +51 -7
- package/dist/providers/core/config/provider-oauth-configs.js.map +1 -1
- package/dist/providers/core/config/service-profiles.js +2 -2
- package/dist/providers/core/config/service-profiles.js.map +1 -1
- package/dist/providers/core/runtime/base-provider-runtime-helpers.js +15 -2
- package/dist/providers/core/runtime/base-provider-runtime-helpers.js.map +1 -1
- package/dist/providers/core/runtime/provider-error-classifier.js +32 -15
- package/dist/providers/core/runtime/provider-error-classifier.js.map +1 -1
- package/dist/providers/core/runtime/provider-family-profile-utils.js +1 -1
- package/dist/providers/core/runtime/provider-family-profile-utils.js.map +1 -1
- package/dist/providers/core/runtime/provider-response-postprocessor.js +61 -14
- package/dist/providers/core/runtime/provider-response-postprocessor.js.map +1 -1
- package/dist/providers/core/strategies/oauth-auth-code-flow.d.ts +1 -0
- package/dist/providers/core/strategies/oauth-auth-code-flow.js +124 -19
- package/dist/providers/core/strategies/oauth-auth-code-flow.js.map +1 -1
- package/dist/providers/core/strategies/oauth-device-flow.js +32 -6
- package/dist/providers/core/strategies/oauth-device-flow.js.map +1 -1
- package/dist/providers/core/utils/provider-error-reporter.js +51 -0
- package/dist/providers/core/utils/provider-error-reporter.js.map +1 -1
- package/dist/providers/profile/families/iflow-profile.js +83 -10
- package/dist/providers/profile/families/iflow-profile.js.map +1 -1
- package/dist/scripts/camoufox/launch-auth.mjs +112 -5
- package/dist/server/handlers/config-admin-handler.js +9 -2
- package/dist/server/handlers/config-admin-handler.js.map +1 -1
- package/dist/server/handlers/handler-response-utils.js +3 -6
- package/dist/server/handlers/handler-response-utils.js.map +1 -1
- package/dist/server/handlers/handler-utils.js +14 -17
- package/dist/server/handlers/handler-utils.js.map +1 -1
- package/dist/server/handlers/logging.js +3 -4
- package/dist/server/handlers/logging.js.map +1 -1
- package/dist/server/handlers/responses-handler.js +5 -3
- package/dist/server/handlers/responses-handler.js.map +1 -1
- package/dist/server/runtime/http-server/daemon-admin/auth-handler.js +5 -3
- package/dist/server/runtime/http-server/daemon-admin/auth-handler.js.map +1 -1
- package/dist/server/runtime/http-server/daemon-admin/control-handler.js +104 -15
- package/dist/server/runtime/http-server/daemon-admin/control-handler.js.map +1 -1
- package/dist/server/runtime/http-server/daemon-admin/credentials-handler.js +2 -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-routing-utils.d.ts +24 -0
- package/dist/server/runtime/http-server/daemon-admin/providers-handler-routing-utils.js +316 -70
- package/dist/server/runtime/http-server/daemon-admin/providers-handler-routing-utils.js.map +1 -1
- package/dist/server/runtime/http-server/daemon-admin/providers-handler.js +190 -1
- package/dist/server/runtime/http-server/daemon-admin/providers-handler.js.map +1 -1
- package/dist/server/runtime/http-server/daemon-admin/routing-policy.d.ts +1 -1
- package/dist/server/runtime/http-server/daemon-admin/routing-policy.js +21 -32
- package/dist/server/runtime/http-server/daemon-admin/routing-policy.js.map +1 -1
- package/dist/server/runtime/http-server/daemon-admin/stats-handler.js +2 -0
- package/dist/server/runtime/http-server/daemon-admin/stats-handler.js.map +1 -1
- package/dist/server/runtime/http-server/daemon-admin-routes.d.ts +8 -1
- package/dist/server/runtime/http-server/daemon-admin-routes.js +30 -0
- package/dist/server/runtime/http-server/daemon-admin-routes.js.map +1 -1
- package/dist/server/runtime/http-server/executor/client-injection-flow.d.ts +14 -0
- package/dist/server/runtime/http-server/executor/client-injection-flow.js +297 -0
- package/dist/server/runtime/http-server/executor/client-injection-flow.js.map +1 -0
- package/dist/server/runtime/http-server/executor/index.d.ts +1 -1
- package/dist/server/runtime/http-server/executor/index.js +1 -1
- package/dist/server/runtime/http-server/executor/index.js.map +1 -1
- package/dist/server/runtime/http-server/executor/provider-response-converter.js +281 -70
- package/dist/server/runtime/http-server/executor/provider-response-converter.js.map +1 -1
- package/dist/server/runtime/http-server/executor/provider-runtime-resolver.js +8 -6
- package/dist/server/runtime/http-server/executor/provider-runtime-resolver.js.map +1 -1
- package/dist/server/runtime/http-server/executor/request-executor-core-utils.d.ts +1 -0
- package/dist/server/runtime/http-server/executor/request-executor-core-utils.js +12 -0
- package/dist/server/runtime/http-server/executor/request-executor-core-utils.js.map +1 -1
- package/dist/server/runtime/http-server/executor/request-retry-helpers.d.ts +1 -1
- package/dist/server/runtime/http-server/executor/request-retry-helpers.js +23 -19
- package/dist/server/runtime/http-server/executor/request-retry-helpers.js.map +1 -1
- package/dist/server/runtime/http-server/executor/retry-engine.d.ts +2 -2
- package/dist/server/runtime/http-server/executor/retry-engine.js +2 -2
- package/dist/server/runtime/http-server/executor/retry-engine.js.map +1 -1
- package/dist/server/runtime/http-server/executor/sse-error-handler.d.ts +1 -0
- package/dist/server/runtime/http-server/executor/sse-error-handler.js +13 -2
- package/dist/server/runtime/http-server/executor/sse-error-handler.js.map +1 -1
- package/dist/server/runtime/http-server/executor/usage-aggregator.d.ts +0 -12
- package/dist/server/runtime/http-server/executor/usage-aggregator.js +89 -90
- package/dist/server/runtime/http-server/executor/usage-aggregator.js.map +1 -1
- package/dist/server/runtime/http-server/executor-metadata.js +318 -17
- package/dist/server/runtime/http-server/executor-metadata.js.map +1 -1
- package/dist/server/runtime/http-server/executor-provider.d.ts +1 -0
- package/dist/server/runtime/http-server/executor-provider.js +5 -1
- package/dist/server/runtime/http-server/executor-provider.js.map +1 -1
- package/dist/server/runtime/http-server/executor-response.d.ts +1 -0
- package/dist/server/runtime/http-server/executor-response.js +52 -58
- package/dist/server/runtime/http-server/executor-response.js.map +1 -1
- package/dist/server/runtime/http-server/http-server-bootstrap.js +50 -6
- package/dist/server/runtime/http-server/http-server-bootstrap.js.map +1 -1
- package/dist/server/runtime/http-server/http-server-lifecycle.js +6 -5
- package/dist/server/runtime/http-server/http-server-lifecycle.js.map +1 -1
- package/dist/server/runtime/http-server/http-server-runtime-setup.js +1 -1
- package/dist/server/runtime/http-server/http-server-runtime-setup.js.map +1 -1
- package/dist/server/runtime/http-server/http-server-session-daemon.d.ts +6 -0
- package/dist/server/runtime/http-server/http-server-session-daemon.js +404 -0
- package/dist/server/runtime/http-server/http-server-session-daemon.js.map +1 -0
- package/dist/server/runtime/http-server/hub-shadow-compare.js +1 -1
- package/dist/server/runtime/http-server/hub-shadow-compare.js.map +1 -1
- package/dist/server/runtime/http-server/index.d.ts +11 -10
- package/dist/server/runtime/http-server/index.js +21 -20
- package/dist/server/runtime/http-server/index.js.map +1 -1
- package/dist/server/runtime/http-server/managed-process-probe.js +1 -1
- package/dist/server/runtime/http-server/managed-process-probe.js.map +1 -1
- package/dist/server/runtime/http-server/middleware.js +91 -5
- package/dist/server/runtime/http-server/middleware.js.map +1 -1
- package/dist/server/runtime/http-server/request-executor.js +19 -9
- package/dist/server/runtime/http-server/request-executor.js.map +1 -1
- package/dist/server/runtime/http-server/routes.d.ts +2 -1
- package/dist/server/runtime/http-server/routes.js +7 -5
- package/dist/server/runtime/http-server/routes.js.map +1 -1
- package/dist/server/runtime/http-server/{clock-client-reaper.d.ts → session-client-reaper.d.ts} +6 -6
- package/dist/server/runtime/http-server/{clock-client-reaper.js → session-client-reaper.js} +26 -49
- package/dist/server/runtime/http-server/session-client-reaper.js.map +1 -0
- package/dist/server/runtime/http-server/{clock-client-registry-utils.d.ts → session-client-registry-utils.d.ts} +14 -10
- package/dist/server/runtime/http-server/{clock-client-registry-utils.js → session-client-registry-utils.js} +77 -19
- package/dist/server/runtime/http-server/session-client-registry-utils.js.map +1 -0
- package/dist/server/runtime/http-server/{clock-client-registry.d.ts → session-client-registry.d.ts} +26 -11
- package/dist/server/runtime/http-server/{clock-client-registry.js → session-client-registry.js} +305 -11
- package/dist/server/runtime/http-server/session-client-registry.js.map +1 -0
- package/dist/server/runtime/http-server/{clock-client-route-utils.d.ts → session-client-route-utils.d.ts} +1 -1
- package/dist/server/runtime/http-server/{clock-client-route-utils.js → session-client-route-utils.js} +4 -4
- package/dist/server/runtime/http-server/session-client-route-utils.js.map +1 -0
- package/dist/server/runtime/http-server/session-client-routes.d.ts +2 -0
- package/dist/server/runtime/http-server/{clock-client-routes.js → session-client-routes.js} +107 -59
- package/dist/server/runtime/http-server/session-client-routes.js.map +1 -0
- package/dist/server/runtime/http-server/session-daemon-inject-config.d.ts +1 -0
- package/dist/server/runtime/http-server/{clock-daemon-inject-config.js → session-daemon-inject-config.js} +2 -2
- package/dist/server/runtime/http-server/session-daemon-inject-config.js.map +1 -0
- package/dist/server/runtime/http-server/session-daemon-log-throttle.d.ts +28 -0
- package/dist/server/runtime/http-server/session-daemon-log-throttle.js +105 -0
- package/dist/server/runtime/http-server/session-daemon-log-throttle.js.map +1 -0
- package/dist/server/runtime/http-server/session-dir.js +12 -1
- package/dist/server/runtime/http-server/session-dir.js.map +1 -1
- package/dist/server/runtime/http-server/session-scope-resolution.d.ts +14 -0
- package/dist/server/runtime/http-server/session-scope-resolution.js +208 -0
- package/dist/server/runtime/http-server/session-scope-resolution.js.map +1 -0
- package/dist/server/runtime/http-server/stats-manager.d.ts +35 -0
- package/dist/server/runtime/http-server/stats-manager.js +269 -21
- package/dist/server/runtime/http-server/stats-manager.js.map +1 -1
- package/dist/server/runtime/http-server/stopmessage-scope-rebind.d.ts +21 -0
- package/dist/server/runtime/http-server/stopmessage-scope-rebind.js +197 -0
- package/dist/server/runtime/http-server/stopmessage-scope-rebind.js.map +1 -0
- package/dist/server/runtime/http-server/tmux-session-probe.d.ts +10 -0
- package/dist/server/runtime/http-server/tmux-session-probe.js +98 -1
- package/dist/server/runtime/http-server/tmux-session-probe.js.map +1 -1
- package/dist/server-lifecycle/port-utils.d.ts +2 -1
- package/dist/server-lifecycle/port-utils.js +84 -4
- package/dist/server-lifecycle/port-utils.js.map +1 -1
- package/dist/token-daemon/index.d.ts +1 -0
- package/dist/token-daemon/index.js +17 -12
- package/dist/token-daemon/index.js.map +1 -1
- package/dist/token-daemon/token-daemon.d.ts +2 -0
- package/dist/token-daemon/token-daemon.js +18 -10
- package/dist/token-daemon/token-daemon.js.map +1 -1
- package/dist/utils/llms-engine-shadow.js +1 -1
- package/dist/utils/llms-engine-shadow.js.map +1 -1
- package/dist/utils/log-helpers.js +46 -0
- package/dist/utils/log-helpers.js.map +1 -1
- package/dist/utils/session-client-token.d.ts +4 -0
- package/dist/utils/session-client-token.js +93 -0
- package/dist/utils/session-client-token.js.map +1 -0
- package/dist/utils/session-scope-trace.d.ts +11 -0
- package/dist/utils/session-scope-trace.js +41 -0
- package/dist/utils/session-scope-trace.js.map +1 -0
- package/docs/CLOCK.md +0 -1
- package/docs/DAEMON_CONTROL_PLANE.md +1 -0
- package/docs/PORTS.md +2 -2
- package/docs/ROUTING_POLICY_SCHEMA.md +5 -3
- package/docs/antigravity-routing-contract.md +2 -2
- package/docs/daemon-admin-ui.html +334 -63
- package/docs/design/servertool-stopmessage-lifecycle.md +109 -0
- package/docs/exec-command-guard-policy.example.v1.json +7 -1
- package/docs/providers/antigravity-gemini-provider-compat.md +2 -2
- package/docs/{clock-client-daemon-design.md → session-client-daemon-design.md} +34 -34
- package/package.json +23 -7
- package/scripts/build-core.mjs +12 -0
- package/scripts/camoufox/launch-auth.mjs +112 -5
- package/scripts/ci/repo-sanity.mjs +1 -0
- package/scripts/compare-responses-sse.mjs +267 -0
- package/scripts/install-global.sh +6 -0
- package/scripts/install-verify.mjs +33 -16
- package/scripts/replay-codex-sample.mjs +52 -6
- package/scripts/run-bg.sh +226 -43
- package/scripts/run-fg-gtimeout.sh +158 -14
- package/scripts/tests/blackbox-rcc-vs-routecodex-antigravity.mjs +3 -3
- package/scripts/tests/ci-jest.mjs +9 -1
- package/scripts/triage-errorsamples.mjs +216 -0
- package/scripts/verify-codex-error-samples.mjs +92 -15
- package/scripts/verify-install-e2e.mjs +57 -27
- package/scripts/virtual-router-dryrun.mjs +7 -1
- package/dist/cli/commands/clock-admin.js.map +0 -1
- package/dist/cli/commands/tmux-inject.js.map +0 -1
- package/dist/cli/register/clock-admin-command.d.ts +0 -3
- package/dist/cli/register/clock-admin-command.js +0 -5
- package/dist/cli/register/clock-admin-command.js.map +0 -1
- package/dist/cli/register/tmux-inject-command.d.ts +0 -3
- package/dist/cli/register/tmux-inject-command.js +0 -5
- package/dist/cli/register/tmux-inject-command.js.map +0 -1
- package/dist/server/runtime/http-server/clock-client-reaper.js.map +0 -1
- package/dist/server/runtime/http-server/clock-client-registry-utils.js.map +0 -1
- package/dist/server/runtime/http-server/clock-client-registry.js.map +0 -1
- package/dist/server/runtime/http-server/clock-client-route-utils.js.map +0 -1
- package/dist/server/runtime/http-server/clock-client-routes.d.ts +0 -2
- package/dist/server/runtime/http-server/clock-client-routes.js.map +0 -1
- package/dist/server/runtime/http-server/clock-daemon-inject-config.d.ts +0 -1
- package/dist/server/runtime/http-server/clock-daemon-inject-config.js.map +0 -1
- package/dist/server/runtime/http-server/clock-daemon-log-throttle.d.ts +0 -12
- package/dist/server/runtime/http-server/clock-daemon-log-throttle.js +0 -56
- package/dist/server/runtime/http-server/clock-daemon-log-throttle.js.map +0 -1
- package/dist/server/runtime/http-server/http-server-clock-daemon.d.ts +0 -5
- package/dist/server/runtime/http-server/http-server-clock-daemon.js +0 -255
- package/dist/server/runtime/http-server/http-server-clock-daemon.js.map +0 -1
- package/dist/utils/clock-client-token.d.ts +0 -3
- package/dist/utils/clock-client-token.js +0 -54
- package/dist/utils/clock-client-token.js.map +0 -1
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Compare inbound vs outbound Responses SSE frames field-by-field.
|
|
3
|
+
// Usage:
|
|
4
|
+
// node scripts/compare-responses-sse.mjs --inbound <file> --outbound <file> [--ignore sequence_number,timestamp] [--limit 20]
|
|
5
|
+
|
|
6
|
+
import fs from 'node:fs';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
|
|
9
|
+
function usage() {
|
|
10
|
+
console.log(`Usage:
|
|
11
|
+
node scripts/compare-responses-sse.mjs --inbound <file> --outbound <file> [--ignore fields] [--limit N]
|
|
12
|
+
|
|
13
|
+
Options:
|
|
14
|
+
--inbound Path to inbound SSE log (frames separated by blank lines).
|
|
15
|
+
--outbound Path to outbound SSE log (frames separated by blank lines).
|
|
16
|
+
--ignore Comma-separated field names to ignore (default: sequence_number).
|
|
17
|
+
--limit Max mismatches to print (default: 20).
|
|
18
|
+
`);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function parseArgs() {
|
|
22
|
+
const args = process.argv.slice(2);
|
|
23
|
+
const opts = { ignore: new Set(['sequence_number']), limit: 20 };
|
|
24
|
+
for (let i = 0; i < args.length; i++) {
|
|
25
|
+
const arg = args[i];
|
|
26
|
+
if (arg === '--inbound') opts.inbound = args[++i];
|
|
27
|
+
else if (arg === '--outbound') opts.outbound = args[++i];
|
|
28
|
+
else if (arg === '--ignore') {
|
|
29
|
+
const raw = (args[++i] || '').trim();
|
|
30
|
+
opts.ignore = new Set(raw ? raw.split(',').map((s) => s.trim()).filter(Boolean) : []);
|
|
31
|
+
} else if (arg === '--limit') {
|
|
32
|
+
opts.limit = Number(args[++i] || 20);
|
|
33
|
+
} else if (arg === '--help' || arg === '-h') {
|
|
34
|
+
usage();
|
|
35
|
+
process.exit(0);
|
|
36
|
+
} else {
|
|
37
|
+
console.error(`Unknown arg: ${arg}`);
|
|
38
|
+
usage();
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (!opts.inbound || !opts.outbound) {
|
|
43
|
+
usage();
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
return opts;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function readFile(file) {
|
|
50
|
+
return fs.readFileSync(path.resolve(file), 'utf8');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function extractRawSse(text) {
|
|
54
|
+
const trimmed = text.trim();
|
|
55
|
+
if (!trimmed.startsWith('{')) {
|
|
56
|
+
return text;
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
const data = JSON.parse(trimmed);
|
|
60
|
+
const raw =
|
|
61
|
+
data?.body?.raw ??
|
|
62
|
+
data?.data?.raw ??
|
|
63
|
+
data?.raw ??
|
|
64
|
+
data?.payload?.raw ??
|
|
65
|
+
data?.body?.payload?.raw;
|
|
66
|
+
if (typeof raw === 'string') {
|
|
67
|
+
return raw;
|
|
68
|
+
}
|
|
69
|
+
} catch {
|
|
70
|
+
// fall through to raw text
|
|
71
|
+
}
|
|
72
|
+
return text;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function splitFrames(text) {
|
|
76
|
+
if (text.includes('\n\n')) {
|
|
77
|
+
return text
|
|
78
|
+
.split(/\n\n+/)
|
|
79
|
+
.map((s) => s.trim())
|
|
80
|
+
.filter(Boolean);
|
|
81
|
+
}
|
|
82
|
+
// Fallback: some captures omit blank lines; split on repeated "event:" headers.
|
|
83
|
+
const lines = text.split('\n');
|
|
84
|
+
const frames = [];
|
|
85
|
+
let current = [];
|
|
86
|
+
for (const line of lines) {
|
|
87
|
+
if (line.startsWith('event:') && current.length) {
|
|
88
|
+
frames.push(current.join('\n').trim());
|
|
89
|
+
current = [];
|
|
90
|
+
}
|
|
91
|
+
if (line.trim().length === 0) {
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
current.push(line);
|
|
95
|
+
}
|
|
96
|
+
if (current.length) {
|
|
97
|
+
frames.push(current.join('\n').trim());
|
|
98
|
+
}
|
|
99
|
+
return frames.filter(Boolean);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function parseFrame(frame, index) {
|
|
103
|
+
const lines = frame.split('\n');
|
|
104
|
+
let event = null;
|
|
105
|
+
let dataLines = [];
|
|
106
|
+
let id = null;
|
|
107
|
+
for (const line of lines) {
|
|
108
|
+
if (line.startsWith('event:')) {
|
|
109
|
+
event = line.slice(6).trim();
|
|
110
|
+
} else if (line.startsWith('data:')) {
|
|
111
|
+
dataLines.push(line.slice(5).trim());
|
|
112
|
+
} else if (line.startsWith('id:')) {
|
|
113
|
+
id = line.slice(3).trim();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const dataRaw = dataLines.join('\n');
|
|
117
|
+
let data;
|
|
118
|
+
if (dataRaw === '[DONE]') {
|
|
119
|
+
data = '[DONE]';
|
|
120
|
+
} else {
|
|
121
|
+
try {
|
|
122
|
+
data = dataRaw ? JSON.parse(dataRaw) : null;
|
|
123
|
+
} catch {
|
|
124
|
+
data = dataRaw;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return { index, event, data, id, raw: frame };
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function parseSseFile(file) {
|
|
131
|
+
const rawText = extractRawSse(readFile(file));
|
|
132
|
+
const frames = splitFrames(rawText);
|
|
133
|
+
return frames.map((frame, index) => parseFrame(frame, index));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function eventKey(ev) {
|
|
137
|
+
const data = ev.data || {};
|
|
138
|
+
if (data && typeof data === 'object') {
|
|
139
|
+
if (data.item && typeof data.item === 'object') {
|
|
140
|
+
if (data.item.id) return `item:${data.item.id}`;
|
|
141
|
+
if (data.item.call_id) return `call:${data.item.call_id}`;
|
|
142
|
+
}
|
|
143
|
+
if (data.item_id) return `item_id:${data.item_id}`;
|
|
144
|
+
if (data.call_id) return `call:${data.call_id}`;
|
|
145
|
+
if (data.response && data.response.id) return `resp:${data.response.id}`;
|
|
146
|
+
if (data.output_index !== undefined) return `out:${data.output_index}`;
|
|
147
|
+
if (data.summary_index !== undefined) return `summary:${data.summary_index}`;
|
|
148
|
+
if (data.content_index !== undefined) return `content:${data.content_index}`;
|
|
149
|
+
}
|
|
150
|
+
return `idx:${ev.index}`;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function normalizeIgnore(ignoreSet) {
|
|
154
|
+
return new Set([...ignoreSet].filter(Boolean));
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function diffValues(a, b, ignoreSet, path = '$', diffs = []) {
|
|
158
|
+
if (ignoreSet.has(path.split('.').slice(-1)[0])) {
|
|
159
|
+
return diffs;
|
|
160
|
+
}
|
|
161
|
+
if (a === b) return diffs;
|
|
162
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
163
|
+
if (a.length !== b.length) {
|
|
164
|
+
diffs.push({ path, a, b, reason: 'array-length' });
|
|
165
|
+
}
|
|
166
|
+
const len = Math.max(a.length, b.length);
|
|
167
|
+
for (let i = 0; i < len; i++) {
|
|
168
|
+
diffValues(a[i], b[i], ignoreSet, `${path}[${i}]`, diffs);
|
|
169
|
+
}
|
|
170
|
+
return diffs;
|
|
171
|
+
}
|
|
172
|
+
if (a && b && typeof a === 'object' && typeof b === 'object') {
|
|
173
|
+
const keys = new Set([...Object.keys(a), ...Object.keys(b)]);
|
|
174
|
+
for (const key of keys) {
|
|
175
|
+
const nextPath = `${path}.${key}`;
|
|
176
|
+
if (ignoreSet.has(key)) {
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
diffValues(a[key], b[key], ignoreSet, nextPath, diffs);
|
|
180
|
+
}
|
|
181
|
+
return diffs;
|
|
182
|
+
}
|
|
183
|
+
diffs.push({ path, a, b, reason: 'value' });
|
|
184
|
+
return diffs;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function groupEvents(events) {
|
|
188
|
+
const map = new Map();
|
|
189
|
+
for (const ev of events) {
|
|
190
|
+
const key = `${ev.event || 'unknown'}|${eventKey(ev)}`;
|
|
191
|
+
if (!map.has(key)) map.set(key, []);
|
|
192
|
+
map.get(key).push(ev);
|
|
193
|
+
}
|
|
194
|
+
return map;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function compare(inbound, outbound, ignoreSet, limit) {
|
|
198
|
+
const inboundMap = groupEvents(inbound);
|
|
199
|
+
const outboundMap = groupEvents(outbound);
|
|
200
|
+
const mismatches = [];
|
|
201
|
+
const missingOutbound = [];
|
|
202
|
+
|
|
203
|
+
for (const [key, inEvents] of inboundMap.entries()) {
|
|
204
|
+
const outEvents = outboundMap.get(key) || [];
|
|
205
|
+
const count = Math.max(inEvents.length, outEvents.length);
|
|
206
|
+
for (let i = 0; i < count; i++) {
|
|
207
|
+
const inEv = inEvents[i];
|
|
208
|
+
const outEv = outEvents[i];
|
|
209
|
+
if (!outEv) {
|
|
210
|
+
missingOutbound.push({ key, inEv });
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
const diffs = diffValues(inEv.data, outEv.data, ignoreSet);
|
|
214
|
+
if (diffs.length) {
|
|
215
|
+
mismatches.push({ key, inEv, outEv, diffs });
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
outboundMap.delete(key);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const extraOutbound = [];
|
|
222
|
+
for (const [key, outEvents] of outboundMap.entries()) {
|
|
223
|
+
for (const outEv of outEvents) {
|
|
224
|
+
extraOutbound.push({ key, outEv });
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
console.log('Summary');
|
|
229
|
+
console.log(`- inbound events: ${inbound.length}`);
|
|
230
|
+
console.log(`- outbound events: ${outbound.length}`);
|
|
231
|
+
console.log(`- missing outbound: ${missingOutbound.length}`);
|
|
232
|
+
console.log(`- extra outbound: ${extraOutbound.length}`);
|
|
233
|
+
console.log(`- mismatches: ${mismatches.length}`);
|
|
234
|
+
|
|
235
|
+
if (missingOutbound.length) {
|
|
236
|
+
console.log('\nMissing outbound (first few):');
|
|
237
|
+
for (const m of missingOutbound.slice(0, limit)) {
|
|
238
|
+
console.log(`- ${m.key}`);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
if (extraOutbound.length) {
|
|
243
|
+
console.log('\nExtra outbound (first few):');
|
|
244
|
+
for (const m of extraOutbound.slice(0, limit)) {
|
|
245
|
+
console.log(`- ${m.key}`);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (mismatches.length) {
|
|
250
|
+
console.log('\nField mismatches (first few):');
|
|
251
|
+
for (const m of mismatches.slice(0, limit)) {
|
|
252
|
+
console.log(`- ${m.key}`);
|
|
253
|
+
for (const diff of m.diffs.slice(0, limit)) {
|
|
254
|
+
console.log(` ${diff.path}: ${JSON.stringify(diff.a)} !== ${JSON.stringify(diff.b)}`);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function main() {
|
|
261
|
+
const opts = parseArgs();
|
|
262
|
+
const inbound = parseSseFile(opts.inbound);
|
|
263
|
+
const outbound = parseSseFile(opts.outbound);
|
|
264
|
+
compare(inbound, outbound, normalizeIgnore(opts.ignore), opts.limit);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
main();
|
|
@@ -196,6 +196,12 @@ verify_install() {
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
verify_server_health() {
|
|
199
|
+
if [ "${ROUTECODEX_INSTALL_SKIP_E2E:-0}" = "1" ]; then
|
|
200
|
+
echo ""
|
|
201
|
+
echo "⏭️ 已跳过全局 CLI 端到端检查(ROUTECODEX_INSTALL_SKIP_E2E=1)"
|
|
202
|
+
return
|
|
203
|
+
fi
|
|
204
|
+
|
|
199
205
|
local HEALTH_LOG="/tmp/routecodex-install-health-$(date +%s).log"
|
|
200
206
|
echo ""
|
|
201
207
|
echo "🩺 执行服务器健康&端到端检查 (chat + anthropic SSE)..."
|
|
@@ -25,6 +25,7 @@ const state = {
|
|
|
25
25
|
logStream: null,
|
|
26
26
|
logPath: '',
|
|
27
27
|
baseUrl: '',
|
|
28
|
+
ownsServer: false,
|
|
28
29
|
};
|
|
29
30
|
let shuttingDown = false;
|
|
30
31
|
let responsesSseParser = null;
|
|
@@ -791,9 +792,12 @@ async function verifyChatStreaming(baseUrl, model, timeoutMs, samplePayload, cha
|
|
|
791
792
|
async function stopServer() {
|
|
792
793
|
const proc = state.serverProc;
|
|
793
794
|
const baseUrl = state.baseUrl;
|
|
794
|
-
if (baseUrl) {
|
|
795
|
+
if (state.ownsServer && baseUrl) {
|
|
795
796
|
try { await fetch(`${baseUrl}/shutdown`, { method: 'POST' }).catch(() => {}); } catch { /* ignore */ }
|
|
796
797
|
}
|
|
798
|
+
if (!state.ownsServer) {
|
|
799
|
+
return;
|
|
800
|
+
}
|
|
797
801
|
if (!proc) {
|
|
798
802
|
if (state.logStream) {
|
|
799
803
|
try { state.logStream.end(); } catch { /* ignore */ }
|
|
@@ -903,18 +907,23 @@ async function main() {
|
|
|
903
907
|
|
|
904
908
|
const model = resolveModel(config);
|
|
905
909
|
console.log(`🔁 模型: ${model}, 端口: ${port}`);
|
|
910
|
+
const buildRestartOnly = (() => {
|
|
911
|
+
const raw = String(process.env.ROUTECODEX_BUILD_RESTART_ONLY ?? process.env.RCC_BUILD_RESTART_ONLY ?? '').trim().toLowerCase();
|
|
912
|
+
return raw === '1' || raw === 'true' || raw === 'yes' || raw === 'on';
|
|
913
|
+
})();
|
|
906
914
|
|
|
907
915
|
const listeners = detectPortPids(port);
|
|
908
|
-
|
|
916
|
+
const reuseExistingServer = buildRestartOnly && listeners.length > 0;
|
|
917
|
+
if (listeners.length && !reuseExistingServer) {
|
|
909
918
|
throw new Error(`端口 ${port} 已被使用 (PID: ${listeners.join(', ')}). 请先停止正在运行的 RouteCodex 实例再重试。`);
|
|
910
919
|
}
|
|
920
|
+
if (reuseExistingServer) {
|
|
921
|
+
console.log(`ℹ build-restart-only: 检测到已运行服务 (PID: ${listeners.join(', ')}),复用现有实例进行验证。`);
|
|
922
|
+
}
|
|
911
923
|
|
|
912
924
|
console.log('🛠️ 动态生成最新的 pipeline 配置...');
|
|
913
925
|
regeneratePipelineConfig({ port, configPath });
|
|
914
926
|
|
|
915
|
-
state.logPath = path.join(os.tmpdir(), `routecodex-install-verify-${Date.now()}.log`);
|
|
916
|
-
const logStream = fs.createWriteStream(state.logPath, { flags: 'a' });
|
|
917
|
-
|
|
918
927
|
let command;
|
|
919
928
|
let commandArgs;
|
|
920
929
|
const env = { ...process.env };
|
|
@@ -933,17 +942,25 @@ async function main() {
|
|
|
933
942
|
env.RCC_PORT = String(port);
|
|
934
943
|
}
|
|
935
944
|
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
945
|
+
if (!reuseExistingServer) {
|
|
946
|
+
state.logPath = path.join(os.tmpdir(), `routecodex-install-verify-${Date.now()}.log`);
|
|
947
|
+
const logStream = fs.createWriteStream(state.logPath, { flags: 'a' });
|
|
948
|
+
state.ownsServer = true;
|
|
949
|
+
console.log(`🚀 启动 RouteCodex server... (launcher=${launcher === 'cli' ? command : 'node dist/index.js'})`);
|
|
950
|
+
const serverProc = spawn(command, commandArgs, {
|
|
951
|
+
cwd,
|
|
952
|
+
env,
|
|
953
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
954
|
+
detached: false,
|
|
955
|
+
});
|
|
956
|
+
serverProc.stdout.pipe(logStream, { end: false });
|
|
957
|
+
serverProc.stderr.pipe(logStream, { end: false });
|
|
958
|
+
state.serverProc = serverProc;
|
|
959
|
+
state.logStream = logStream;
|
|
960
|
+
} else {
|
|
961
|
+
state.ownsServer = false;
|
|
962
|
+
state.serverProc = null;
|
|
963
|
+
}
|
|
947
964
|
|
|
948
965
|
await waitForHealth(baseUrl, 90000);
|
|
949
966
|
console.log('✅ server 健康检查通过');
|
|
@@ -7,7 +7,13 @@ import path from 'node:path';
|
|
|
7
7
|
|
|
8
8
|
const DEFAULT_BASE_URL = process.env.ROUTECODEX_BASE || 'http://127.0.0.1:5555';
|
|
9
9
|
const DEFAULT_API_KEY = process.env.ROUTECODEX_API_KEY || 'routecodex-test';
|
|
10
|
-
const HEADER_DENYLIST = new Set([
|
|
10
|
+
const HEADER_DENYLIST = new Set([
|
|
11
|
+
'authorization',
|
|
12
|
+
'content-length',
|
|
13
|
+
'host',
|
|
14
|
+
'accept',
|
|
15
|
+
'content-type'
|
|
16
|
+
]);
|
|
11
17
|
|
|
12
18
|
function usage() {
|
|
13
19
|
console.log(`Usage:
|
|
@@ -70,6 +76,7 @@ function extractSampleHeaders(doc) {
|
|
|
70
76
|
return {};
|
|
71
77
|
}
|
|
72
78
|
const headers = {};
|
|
79
|
+
const seen = new Set();
|
|
73
80
|
for (const [key, value] of Object.entries(raw)) {
|
|
74
81
|
if (typeof value !== 'string' || !value.trim()) {
|
|
75
82
|
continue;
|
|
@@ -78,11 +85,38 @@ function extractSampleHeaders(doc) {
|
|
|
78
85
|
if (HEADER_DENYLIST.has(lowered)) {
|
|
79
86
|
continue;
|
|
80
87
|
}
|
|
81
|
-
|
|
88
|
+
if (seen.has(lowered)) {
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
headers[lowered] = value;
|
|
92
|
+
seen.add(lowered);
|
|
82
93
|
}
|
|
83
94
|
return headers;
|
|
84
95
|
}
|
|
85
96
|
|
|
97
|
+
function redactAuthorization(value) {
|
|
98
|
+
if (typeof value !== 'string' || !value.trim()) return value;
|
|
99
|
+
const marker = '::rcc-session:';
|
|
100
|
+
const idx = value.indexOf(marker);
|
|
101
|
+
if (idx >= 0) {
|
|
102
|
+
return `***${value.slice(idx)}`;
|
|
103
|
+
}
|
|
104
|
+
return '***';
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function extractTmuxSessionIdFromKey(value) {
|
|
108
|
+
if (typeof value !== 'string' || !value.trim()) return null;
|
|
109
|
+
const marker = '::rcc-session:';
|
|
110
|
+
const idx = value.lastIndexOf(marker);
|
|
111
|
+
if (idx < 0) return null;
|
|
112
|
+
const start = idx + marker.length;
|
|
113
|
+
if (start >= value.length) return null;
|
|
114
|
+
const nextIdx = value.indexOf('::rcc-sessiond:', start);
|
|
115
|
+
const end = nextIdx >= 0 ? nextIdx : value.length;
|
|
116
|
+
const token = value.slice(start, end).trim();
|
|
117
|
+
return token || null;
|
|
118
|
+
}
|
|
119
|
+
|
|
86
120
|
async function readSse(response) {
|
|
87
121
|
const reader = response.body?.getReader();
|
|
88
122
|
if (!reader) throw new Error('Response is not streamable');
|
|
@@ -126,10 +160,15 @@ async function main() {
|
|
|
126
160
|
...sampleHeaders,
|
|
127
161
|
'Content-Type': 'application/json',
|
|
128
162
|
'Accept': wantsSse ? 'text/event-stream' : 'application/json',
|
|
129
|
-
|
|
130
|
-
'
|
|
131
|
-
'
|
|
163
|
+
// Use x-routecodex-api-key to avoid Authorization header sanitization in some clients.
|
|
164
|
+
'x-routecodex-api-key': opts.key,
|
|
165
|
+
'OpenAI-Beta': sampleHeaders['openai-beta'] || 'responses-2024-12-17',
|
|
166
|
+
'X-Route-Hint': sampleHeaders['x-route-hint'] || 'default'
|
|
132
167
|
};
|
|
168
|
+
const inferredTmux = extractTmuxSessionIdFromKey(opts.key);
|
|
169
|
+
if (inferredTmux && !sampleHeaders['x-routecodex-client-tmux-session-id']) {
|
|
170
|
+
headers['x-routecodex-client-tmux-session-id'] = inferredTmux;
|
|
171
|
+
}
|
|
133
172
|
|
|
134
173
|
console.log(`[replay-codex-sample] ${endpoint} → ${targetUrl} (requestId=${requestId})`);
|
|
135
174
|
|
|
@@ -147,7 +186,14 @@ async function main() {
|
|
|
147
186
|
statusText: res.statusText,
|
|
148
187
|
headers: Object.fromEntries(res.headers.entries())
|
|
149
188
|
};
|
|
150
|
-
|
|
189
|
+
const debugHeaders = { ...headers };
|
|
190
|
+
if (typeof debugHeaders['x-routecodex-api-key'] === 'string') {
|
|
191
|
+
debugHeaders['x-routecodex-api-key'] = redactAuthorization(debugHeaders['x-routecodex-api-key']);
|
|
192
|
+
}
|
|
193
|
+
fs.writeFileSync(
|
|
194
|
+
path.join(runDir, 'request.json'),
|
|
195
|
+
JSON.stringify({ endpoint, body: requestBody, headers: debugHeaders }, null, 2)
|
|
196
|
+
);
|
|
151
197
|
fs.writeFileSync(path.join(runDir, 'response.meta.json'), JSON.stringify(meta, null, 2));
|
|
152
198
|
|
|
153
199
|
if (!res.ok) {
|