@cartanova/qgrid-cli 2.7.1 → 2.7.3
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.ko.md +3 -2
- package/README.md +3 -2
- package/bundle/dist/application/monit/monit.frame.js +27 -14
- package/bundle/dist/application/monit/monit.types.js +22 -13
- package/bundle/dist/application/qgrid/conv-routing.js +21 -11
- package/bundle/dist/application/qgrid/oauth.js +1 -1
- package/bundle/dist/application/qgrid/qgrid-run-lifecycle.js +15 -4
- package/bundle/dist/application/qgrid/qgrid.dispatcher.js +18 -9
- package/bundle/dist/application/qgrid/qgrid.frame.js +50 -73
- package/bundle/dist/application/qgrid/qgrid.types.js +4 -1
- package/bundle/dist/application/qgrid/token-subscriber.js +5 -5
- package/bundle/dist/application/qgrid/tool-emulation-schema.js +13 -1
- package/bundle/dist/application/qgrid/tool-emulation.js +1 -1
- package/bundle/dist/application/queries.generated.js +3 -1
- package/bundle/dist/application/request-log/json-schema-type-text.js +55 -0
- package/bundle/dist/application/request-log/request-log.model.js +85 -3
- package/bundle/dist/application/request-log/request-log.types.js +3 -2
- package/bundle/dist/application/request-log/zod-code-format.js +71 -0
- package/bundle/dist/application/setting/setting.constant.js +2 -62
- package/bundle/dist/application/setting/setting.model.js +3 -3
- package/bundle/dist/application/setting/setting.store.js +2 -2
- package/bundle/dist/application/sonamu.generated.js +11 -4
- package/bundle/dist/application/sonamu.generated.sso.js +7 -3
- package/bundle/dist/i18n/sd.generated.js +5 -2
- package/bundle/dist/migrations/20260814130113_alter_request_logs_add1_alter1.js +15 -0
- package/bundle/dist/migrations/20260814131051_alter_request_logs_add1_alter1.js +15 -0
- package/bundle/dist/migrations/20260814134846_alter_request_logs_add1_alter1.js +15 -0
- package/bundle/dist/migrations/20260814140759_alter_request_logs_alter1.js +13 -0
- package/bundle/dist/node_modules/.pnpm/{vite@8.0.3_@emnapi_core@1.11.2_@emnapi_runtime@1.11.2_@types_node@25.0.7_esbuild@0.27.4_2519c2e8d8013fcbc7b443879bc9da6d → vite@8.0.3_@emnapi_core@1.11.2_@emnapi_runtime@1.11.2_@types_node@25.0.7_esbuild@0.27.4_5b35fc1fb85d2af4d105e0d74f940f50}/node_modules/vite/dist/node/module-runner.js +2 -2
- package/bundle/dist/node_modules/.pnpm/{vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_ms_f9cfcfeddd63e656d4010c98521af26c → vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_vi_a1977b93af7bb69308bcb1dbab39b618}/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.js +2 -2
- package/bundle/dist/node_modules/.pnpm/{vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_ms_f9cfcfeddd63e656d4010c98521af26c → vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_vi_a1977b93af7bb69308bcb1dbab39b618}/node_modules/vitest/dist/chunks/benchmark.CX_oY03V.js +2 -2
- package/bundle/dist/node_modules/.pnpm/{vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_ms_f9cfcfeddd63e656d4010c98521af26c → vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_vi_a1977b93af7bb69308bcb1dbab39b618}/node_modules/vitest/dist/chunks/evaluatedModules.Dg1zASAC.js +3 -3
- package/bundle/dist/node_modules/.pnpm/{vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_ms_f9cfcfeddd63e656d4010c98521af26c → vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_vi_a1977b93af7bb69308bcb1dbab39b618}/node_modules/vitest/dist/chunks/index.Chj8NDwU.js +2 -2
- package/bundle/dist/node_modules/.pnpm/{vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_ms_f9cfcfeddd63e656d4010c98521af26c → vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_vi_a1977b93af7bb69308bcb1dbab39b618}/node_modules/vitest/dist/chunks/index.DdgEv5B1.js +2 -2
- package/bundle/dist/node_modules/.pnpm/{vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_ms_f9cfcfeddd63e656d4010c98521af26c → vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_vi_a1977b93af7bb69308bcb1dbab39b618}/node_modules/vitest/dist/chunks/rpc.MzXet3jl.js +2 -2
- package/bundle/dist/node_modules/.pnpm/{vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_ms_f9cfcfeddd63e656d4010c98521af26c → vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_vi_a1977b93af7bb69308bcb1dbab39b618}/node_modules/vitest/dist/chunks/test.DNmyFkvJ.js +2 -2
- package/bundle/dist/node_modules/.pnpm/{vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_ms_f9cfcfeddd63e656d4010c98521af26c → vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_vi_a1977b93af7bb69308bcb1dbab39b618}/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.js +2 -2
- package/bundle/dist/node_modules/.pnpm/{vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_ms_f9cfcfeddd63e656d4010c98521af26c → vitest@4.1.10_@opentelemetry_api@1.9.0_@types_node@25.0.7_@vitest_coverage-v8@4.1.10_vi_a1977b93af7bb69308bcb1dbab39b618}/node_modules/vitest/dist/index.js +2 -2
- package/bundle/dist/sonamu.config.js +10 -9
- package/bundle/dist/testing/setup-mocks.js +2 -2
- package/bundle/dist/utils/providers/anthropic/anthropic-dispatcher.js +14 -2
- package/bundle/dist/utils/providers/anthropic/claude-session.js +1 -1
- package/bundle/dist/utils/providers/anthropic/stream-json-adapter.js +1 -1
- package/bundle/dist/utils/providers/common/model-cost.js +1 -1
- package/bundle/dist/utils/providers/common/schema-validation.js +1 -1
- package/bundle/dist/utils/providers/openai/openai-backend-protocol.js +144 -0
- package/bundle/dist/utils/providers/openai/openai-constants.js +4 -2
- package/bundle/dist/utils/providers/openai/openai-direct-client.js +327 -0
- package/bundle/dist/utils/providers/openai/openai-dispatcher.js +358 -781
- package/bundle/dist/utils/providers/openai/openai-oauth.js +84 -0
- package/bundle/dist/utils/providers/openai/openai-quota.js +76 -5
- package/bundle/dist/utils/providers/openai/openai-refresh.js +3 -3
- package/bundle/dist/utils/providers/openai/openai-sse.js +72 -0
- package/bundle/dist/utils/providers/openai/openai-transport-config.js +14 -0
- package/bundle/src/application/monit/monit.frame.test.ts +14 -17
- package/bundle/src/application/monit/monit.frame.ts +23 -12
- package/bundle/src/application/monit/monit.types.ts +40 -11
- package/bundle/src/application/qgrid/conv-routing.test.ts +67 -0
- package/bundle/src/application/qgrid/conv-routing.ts +46 -12
- package/bundle/src/application/qgrid/qgrid-oauth-redirect.test.ts +92 -2
- package/bundle/src/application/qgrid/qgrid-run-lifecycle.test.ts +3 -0
- package/bundle/src/application/qgrid/qgrid-run-lifecycle.ts +15 -1
- package/bundle/src/application/qgrid/qgrid.dispatcher.test.ts +36 -6
- package/bundle/src/application/qgrid/qgrid.dispatcher.ts +22 -9
- package/bundle/src/application/qgrid/qgrid.frame.ts +55 -94
- package/bundle/src/application/qgrid/qgrid.types.ts +11 -4
- package/bundle/src/application/qgrid/token-subscriber.ts +4 -4
- package/bundle/src/application/qgrid/tool-emulation-schema.ts +1 -1
- package/bundle/src/application/qgrid/tool-emulation.test.ts +1 -0
- package/bundle/src/application/queries.generated.ts +6 -0
- package/bundle/src/application/request-log/json-schema-type-text.test.ts +96 -0
- package/bundle/src/application/request-log/json-schema-type-text.ts +83 -0
- package/bundle/src/application/request-log/request-log.entity.json +147 -21
- package/bundle/src/application/request-log/request-log.model.ts +108 -0
- package/bundle/src/application/request-log/request-log.types.ts +2 -0
- package/bundle/src/application/request-log/zod-code-format.test.ts +31 -0
- package/bundle/src/application/request-log/zod-code-format.ts +73 -0
- package/bundle/src/application/setting/setting.constant.test.ts +22 -24
- package/bundle/src/application/setting/setting.constant.ts +2 -63
- package/bundle/src/application/setting/setting.entity.json +1 -1
- package/bundle/src/application/setting/setting.store.ts +1 -1
- package/bundle/src/application/sonamu.generated.http +20 -1
- package/bundle/src/application/sonamu.generated.sso.ts +4 -0
- package/bundle/src/application/sonamu.generated.ts +10 -0
- package/bundle/src/i18n/sd.generated.ts +6 -1
- package/bundle/src/migrations/20260814130113_alter_request_logs_add1_alter1.ts +15 -0
- package/bundle/src/migrations/20260814131051_alter_request_logs_add1_alter1.ts +15 -0
- package/bundle/src/migrations/20260814134846_alter_request_logs_add1_alter1.ts +15 -0
- package/bundle/src/migrations/20260814140759_alter_request_logs_alter1.ts +13 -0
- package/bundle/src/sonamu.config.ts +9 -13
- package/bundle/src/utils/providers/anthropic/anthropic-dispatcher.ts +17 -2
- package/bundle/src/utils/providers/anthropic/claude-session.ts +1 -3
- package/bundle/src/utils/providers/anthropic/stream-json-adapter.test.ts +1 -2
- package/bundle/src/utils/providers/anthropic/stream-json-adapter.ts +2 -3
- package/bundle/src/utils/providers/common/model-cost.ts +4 -9
- package/bundle/src/utils/providers/common/provider-dispatcher.ts +10 -8
- package/bundle/src/utils/providers/common/provider-types.ts +48 -0
- package/bundle/src/utils/providers/common/schema-validation.ts +1 -1
- package/bundle/src/utils/providers/openai/openai-backend-protocol.test.ts +106 -0
- package/bundle/src/utils/providers/openai/openai-backend-protocol.ts +255 -0
- package/bundle/src/utils/providers/openai/openai-constants.ts +2 -0
- package/bundle/src/utils/providers/openai/openai-direct-client.test.ts +610 -0
- package/bundle/src/utils/providers/openai/openai-direct-client.ts +478 -0
- package/bundle/src/utils/providers/openai/openai-dispatcher.test.ts +336 -1723
- package/bundle/src/utils/providers/openai/openai-dispatcher.ts +458 -1175
- package/bundle/src/utils/providers/openai/openai-oauth.test.ts +95 -0
- package/bundle/src/utils/providers/openai/openai-oauth.ts +141 -0
- package/bundle/src/utils/providers/openai/openai-quota.test.ts +80 -7
- package/bundle/src/utils/providers/openai/openai-quota.ts +105 -4
- package/bundle/src/utils/providers/openai/openai-refresh.test.ts +120 -0
- package/bundle/src/utils/providers/openai/openai-refresh.ts +3 -1
- package/bundle/src/utils/providers/openai/openai-sse.test.ts +52 -0
- package/bundle/src/utils/providers/openai/openai-sse.ts +79 -0
- package/bundle/src/utils/providers/openai/openai-transport-config.ts +17 -0
- package/bundle/web-dist/client/assets/index-BldeEvAK.css +1 -0
- package/bundle/web-dist/client/assets/index-QxWJK2qE.js +106 -0
- package/bundle/web-dist/client/assets/logs-DaNYzis5.js +1 -0
- package/bundle/web-dist/client/assets/monit-BngOoU4n.js +1 -0
- package/bundle/web-dist/client/assets/{routes-J4bnHVfl.js → routes-BnQE0rPF.js} +1 -1
- package/bundle/web-dist/client/assets/{services.generated-jGypfumC.js → services.generated-CSW8bhCP.js} +4 -4
- package/bundle/web-dist/client/assets/settings-CPeAjsL3.js +1 -0
- package/bundle/web-dist/client/assets/show-DUOfuZj1.js +2 -0
- package/bundle/web-dist/client/assets/{tokens-DDrATjGA.js → tokens-LHoEigmF.js} +1 -1
- package/bundle/web-dist/client/assets/{use-oauth-login-flow-CptleCFM.js → use-oauth-login-flow-YyU4TDzU.js} +1 -1
- package/bundle/web-dist/client/index.html +3 -3
- package/bundle/web-dist/server/assets/{lazyRouteComponent-DOc8TV-P.js → lazyRouteComponent-0y-znAfz.js} +2 -2
- package/bundle/web-dist/server/assets/{logs-CfF3nmLM.js → logs-CJBbHM3_.js} +35 -5
- package/bundle/web-dist/server/assets/{monit-BSaKhh5D.js → monit-8WAsPETB.js} +144 -51
- package/bundle/web-dist/server/assets/{plus-DLFUHsfx.js → plus-9das21ju.js} +1 -1
- package/bundle/web-dist/server/assets/{react-dom-BotjLnTK.js → react-dom-zmEq8BVp.js} +1 -1
- package/bundle/web-dist/server/assets/{routes-CHMxrTT0.js → routes-B6bX3o41.js} +3 -3
- package/bundle/web-dist/server/assets/{services.generated-D3Q3FYot.js → services.generated-DyPeBI00.js} +76 -2
- package/bundle/web-dist/server/assets/{settings-DOQjV28c.js → settings-D1u5WdpP.js} +2 -3
- package/bundle/web-dist/server/assets/{show-Cn_C6Qvl.js → show-Cr7vwR0l.js} +93 -8
- package/bundle/web-dist/server/assets/{tokens-c0EN3iCx.js → tokens-BumM0gnH.js} +3 -3
- package/bundle/web-dist/server/assets/{use-oauth-login-flow-B68AbMDE.js → use-oauth-login-flow-DmsHGOlx.js} +1 -1
- package/bundle/web-dist/server/entry-server.generated.js +12 -12
- package/dist/cli.d.ts +10 -1
- package/dist/cli.js +1 -6
- package/package.json +11 -5
- package/skills/qgrid/SKILL.md +5 -5
- package/skills/qgrid/references/ai-sdk-provider-contract.md +16 -10
- package/skills/qgrid/references/cli-env-and-server-boot.md +6 -13
- package/skills/qgrid/references/decision-rationale.md +15 -23
- package/skills/qgrid/references/docs-workflow.md +1 -1
- package/skills/qgrid/references/openai-codex-runtime.md +39 -156
- package/skills/qgrid/references/prompt-cache-and-usage.md +35 -71
- package/skills/qgrid/references/provider-runtime-differences.md +17 -17
- package/skills/qgrid/references/repo-map.md +2 -2
- package/skills/qgrid/references/request-log-run-lifecycle.md +12 -2
- package/skills/qgrid/references/sonamu-api-web-flow.md +4 -0
- package/skills/qgrid/references/token-auth-quota-lifecycle.md +14 -24
- package/skills/qgrid/references/tool-calling-and-multiturn.md +3 -3
- package/skills/qgrid/references/verification-and-debugging.md +17 -15
- package/bundle/dist/codex-protocol/AgentPath.js +0 -1
- package/bundle/dist/codex-protocol/ApplyPatchApprovalParams.js +0 -1
- package/bundle/dist/codex-protocol/ApplyPatchApprovalResponse.js +0 -1
- package/bundle/dist/codex-protocol/AuthMode.js +0 -1
- package/bundle/dist/codex-protocol/ClientInfo.js +0 -1
- package/bundle/dist/codex-protocol/ClientNotification.js +0 -1
- package/bundle/dist/codex-protocol/ClientRequest.js +0 -1
- package/bundle/dist/codex-protocol/CollaborationMode.js +0 -1
- package/bundle/dist/codex-protocol/ContentItem.js +0 -1
- package/bundle/dist/codex-protocol/ConversationGitInfo.js +0 -1
- package/bundle/dist/codex-protocol/ConversationSummary.js +0 -1
- package/bundle/dist/codex-protocol/ExecCommandApprovalParams.js +0 -1
- package/bundle/dist/codex-protocol/ExecCommandApprovalResponse.js +0 -1
- package/bundle/dist/codex-protocol/ExecPolicyAmendment.js +0 -1
- package/bundle/dist/codex-protocol/FileChange.js +0 -1
- package/bundle/dist/codex-protocol/ForcedLoginMethod.js +0 -1
- package/bundle/dist/codex-protocol/FunctionCallOutputBody.js +0 -1
- package/bundle/dist/codex-protocol/FunctionCallOutputContentItem.js +0 -1
- package/bundle/dist/codex-protocol/FuzzyFileSearchMatchType.js +0 -1
- package/bundle/dist/codex-protocol/FuzzyFileSearchParams.js +0 -1
- package/bundle/dist/codex-protocol/FuzzyFileSearchResponse.js +0 -1
- package/bundle/dist/codex-protocol/FuzzyFileSearchResult.js +0 -1
- package/bundle/dist/codex-protocol/FuzzyFileSearchSessionCompletedNotification.js +0 -1
- package/bundle/dist/codex-protocol/FuzzyFileSearchSessionUpdatedNotification.js +0 -1
- package/bundle/dist/codex-protocol/GetAuthStatusParams.js +0 -1
- package/bundle/dist/codex-protocol/GetAuthStatusResponse.js +0 -1
- package/bundle/dist/codex-protocol/GetConversationSummaryParams.js +0 -1
- package/bundle/dist/codex-protocol/GetConversationSummaryResponse.js +0 -1
- package/bundle/dist/codex-protocol/GitDiffToRemoteParams.js +0 -1
- package/bundle/dist/codex-protocol/GitDiffToRemoteResponse.js +0 -1
- package/bundle/dist/codex-protocol/GitSha.js +0 -1
- package/bundle/dist/codex-protocol/ImageDetail.js +0 -1
- package/bundle/dist/codex-protocol/InitializeCapabilities.js +0 -1
- package/bundle/dist/codex-protocol/InitializeParams.js +0 -1
- package/bundle/dist/codex-protocol/InitializeResponse.js +0 -1
- package/bundle/dist/codex-protocol/InputModality.js +0 -1
- package/bundle/dist/codex-protocol/InternalSessionSource.js +0 -1
- package/bundle/dist/codex-protocol/LocalShellAction.js +0 -1
- package/bundle/dist/codex-protocol/LocalShellExecAction.js +0 -1
- package/bundle/dist/codex-protocol/LocalShellStatus.js +0 -1
- package/bundle/dist/codex-protocol/MessagePhase.js +0 -1
- package/bundle/dist/codex-protocol/ModeKind.js +0 -1
- package/bundle/dist/codex-protocol/NetworkPolicyAmendment.js +0 -1
- package/bundle/dist/codex-protocol/NetworkPolicyRuleAction.js +0 -1
- package/bundle/dist/codex-protocol/ParsedCommand.js +0 -1
- package/bundle/dist/codex-protocol/Personality.js +0 -1
- package/bundle/dist/codex-protocol/PlanType.js +0 -1
- package/bundle/dist/codex-protocol/RealtimeConversationVersion.js +0 -1
- package/bundle/dist/codex-protocol/RealtimeOutputModality.js +0 -1
- package/bundle/dist/codex-protocol/RealtimeVoice.js +0 -1
- package/bundle/dist/codex-protocol/RealtimeVoicesList.js +0 -1
- package/bundle/dist/codex-protocol/ReasoningEffort.js +0 -1
- package/bundle/dist/codex-protocol/ReasoningItemContent.js +0 -1
- package/bundle/dist/codex-protocol/ReasoningItemReasoningSummary.js +0 -1
- package/bundle/dist/codex-protocol/ReasoningSummary.js +0 -1
- package/bundle/dist/codex-protocol/RequestId.js +0 -1
- package/bundle/dist/codex-protocol/Resource.js +0 -1
- package/bundle/dist/codex-protocol/ResourceContent.js +0 -1
- package/bundle/dist/codex-protocol/ResourceTemplate.js +0 -1
- package/bundle/dist/codex-protocol/ResponseItem.js +0 -1
- package/bundle/dist/codex-protocol/ReviewDecision.js +0 -1
- package/bundle/dist/codex-protocol/ServerNotification.js +0 -1
- package/bundle/dist/codex-protocol/ServerRequest.js +0 -1
- package/bundle/dist/codex-protocol/SessionSource.js +0 -1
- package/bundle/dist/codex-protocol/Settings.js +0 -1
- package/bundle/dist/codex-protocol/SubAgentSource.js +0 -1
- package/bundle/dist/codex-protocol/ThreadId.js +0 -1
- package/bundle/dist/codex-protocol/ThreadMemoryMode.js +0 -1
- package/bundle/dist/codex-protocol/Tool.js +0 -1
- package/bundle/dist/codex-protocol/Verbosity.js +0 -1
- package/bundle/dist/codex-protocol/WebSearchAction.js +0 -1
- package/bundle/dist/codex-protocol/WebSearchContextSize.js +0 -1
- package/bundle/dist/codex-protocol/WebSearchLocation.js +0 -1
- package/bundle/dist/codex-protocol/WebSearchMode.js +0 -1
- package/bundle/dist/codex-protocol/WebSearchToolConfig.js +0 -1
- package/bundle/dist/codex-protocol/index.js +0 -2
- package/bundle/dist/codex-protocol/serde_json/JsonValue.js +0 -1
- package/bundle/dist/codex-protocol/v2/Account.js +0 -1
- package/bundle/dist/codex-protocol/v2/AccountLoginCompletedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/AccountRateLimitsUpdatedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/AccountUpdatedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ActivePermissionProfile.js +0 -1
- package/bundle/dist/codex-protocol/v2/ActivePermissionProfileModification.js +0 -1
- package/bundle/dist/codex-protocol/v2/AddCreditsNudgeCreditType.js +0 -1
- package/bundle/dist/codex-protocol/v2/AddCreditsNudgeEmailStatus.js +0 -1
- package/bundle/dist/codex-protocol/v2/AdditionalFileSystemPermissions.js +0 -1
- package/bundle/dist/codex-protocol/v2/AdditionalNetworkPermissions.js +0 -1
- package/bundle/dist/codex-protocol/v2/AdditionalPermissionProfile.js +0 -1
- package/bundle/dist/codex-protocol/v2/AgentMessageDeltaNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/AnalyticsConfig.js +0 -1
- package/bundle/dist/codex-protocol/v2/AppBranding.js +0 -1
- package/bundle/dist/codex-protocol/v2/AppInfo.js +0 -1
- package/bundle/dist/codex-protocol/v2/AppListUpdatedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/AppMetadata.js +0 -1
- package/bundle/dist/codex-protocol/v2/AppReview.js +0 -1
- package/bundle/dist/codex-protocol/v2/AppScreenshot.js +0 -1
- package/bundle/dist/codex-protocol/v2/AppSummary.js +0 -1
- package/bundle/dist/codex-protocol/v2/AppToolApproval.js +0 -1
- package/bundle/dist/codex-protocol/v2/AppToolsConfig.js +0 -1
- package/bundle/dist/codex-protocol/v2/ApprovalsReviewer.js +0 -1
- package/bundle/dist/codex-protocol/v2/AppsConfig.js +0 -1
- package/bundle/dist/codex-protocol/v2/AppsDefaultConfig.js +0 -1
- package/bundle/dist/codex-protocol/v2/AppsListParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/AppsListResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/AskForApproval.js +0 -1
- package/bundle/dist/codex-protocol/v2/AutoReviewDecisionSource.js +0 -1
- package/bundle/dist/codex-protocol/v2/ByteRange.js +0 -1
- package/bundle/dist/codex-protocol/v2/CancelLoginAccountParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/CancelLoginAccountResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/CancelLoginAccountStatus.js +0 -1
- package/bundle/dist/codex-protocol/v2/ChatgptAuthTokensRefreshParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ChatgptAuthTokensRefreshReason.js +0 -1
- package/bundle/dist/codex-protocol/v2/ChatgptAuthTokensRefreshResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/CodexErrorInfo.js +0 -1
- package/bundle/dist/codex-protocol/v2/CollabAgentState.js +0 -1
- package/bundle/dist/codex-protocol/v2/CollabAgentStatus.js +0 -1
- package/bundle/dist/codex-protocol/v2/CollabAgentTool.js +0 -1
- package/bundle/dist/codex-protocol/v2/CollabAgentToolCallStatus.js +0 -1
- package/bundle/dist/codex-protocol/v2/CollaborationModeMask.js +0 -1
- package/bundle/dist/codex-protocol/v2/CommandAction.js +0 -1
- package/bundle/dist/codex-protocol/v2/CommandExecOutputDeltaNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/CommandExecOutputStream.js +0 -1
- package/bundle/dist/codex-protocol/v2/CommandExecParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/CommandExecResizeParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/CommandExecResizeResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/CommandExecResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/CommandExecTerminalSize.js +0 -1
- package/bundle/dist/codex-protocol/v2/CommandExecTerminateParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/CommandExecTerminateResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/CommandExecWriteParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/CommandExecWriteResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/CommandExecutionApprovalDecision.js +0 -1
- package/bundle/dist/codex-protocol/v2/CommandExecutionOutputDeltaNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/CommandExecutionRequestApprovalParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/CommandExecutionRequestApprovalResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/CommandExecutionSource.js +0 -1
- package/bundle/dist/codex-protocol/v2/CommandExecutionStatus.js +0 -1
- package/bundle/dist/codex-protocol/v2/CommandMigration.js +0 -1
- package/bundle/dist/codex-protocol/v2/Config.js +0 -1
- package/bundle/dist/codex-protocol/v2/ConfigBatchWriteParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ConfigEdit.js +0 -1
- package/bundle/dist/codex-protocol/v2/ConfigLayer.js +0 -1
- package/bundle/dist/codex-protocol/v2/ConfigLayerMetadata.js +0 -1
- package/bundle/dist/codex-protocol/v2/ConfigLayerSource.js +0 -1
- package/bundle/dist/codex-protocol/v2/ConfigReadParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ConfigReadResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ConfigRequirements.js +0 -1
- package/bundle/dist/codex-protocol/v2/ConfigRequirementsReadResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ConfigValueWriteParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ConfigWarningNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ConfigWriteResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ConfiguredHookHandler.js +0 -1
- package/bundle/dist/codex-protocol/v2/ConfiguredHookMatcherGroup.js +0 -1
- package/bundle/dist/codex-protocol/v2/ContextCompactedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/CreditsSnapshot.js +0 -1
- package/bundle/dist/codex-protocol/v2/DeprecationNoticeNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/DynamicToolCallOutputContentItem.js +0 -1
- package/bundle/dist/codex-protocol/v2/DynamicToolCallParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/DynamicToolCallResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/DynamicToolCallStatus.js +0 -1
- package/bundle/dist/codex-protocol/v2/DynamicToolSpec.js +0 -1
- package/bundle/dist/codex-protocol/v2/ErrorNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ExecPolicyAmendment.js +0 -1
- package/bundle/dist/codex-protocol/v2/ExperimentalFeature.js +0 -1
- package/bundle/dist/codex-protocol/v2/ExperimentalFeatureEnablementSetParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ExperimentalFeatureEnablementSetResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ExperimentalFeatureListParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ExperimentalFeatureListResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ExperimentalFeatureStage.js +0 -1
- package/bundle/dist/codex-protocol/v2/ExternalAgentConfigDetectParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ExternalAgentConfigDetectResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ExternalAgentConfigImportCompletedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ExternalAgentConfigImportParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ExternalAgentConfigImportResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ExternalAgentConfigMigrationItem.js +0 -1
- package/bundle/dist/codex-protocol/v2/ExternalAgentConfigMigrationItemType.js +0 -1
- package/bundle/dist/codex-protocol/v2/FeedbackUploadParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/FeedbackUploadResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/FileChangeApprovalDecision.js +0 -1
- package/bundle/dist/codex-protocol/v2/FileChangeOutputDeltaNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/FileChangePatchUpdatedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/FileChangeRequestApprovalParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/FileChangeRequestApprovalResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/FileSystemAccessMode.js +0 -1
- package/bundle/dist/codex-protocol/v2/FileSystemPath.js +0 -1
- package/bundle/dist/codex-protocol/v2/FileSystemSandboxEntry.js +0 -1
- package/bundle/dist/codex-protocol/v2/FileSystemSpecialPath.js +0 -1
- package/bundle/dist/codex-protocol/v2/FileUpdateChange.js +0 -1
- package/bundle/dist/codex-protocol/v2/FsChangedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/FsCopyParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/FsCopyResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/FsCreateDirectoryParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/FsCreateDirectoryResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/FsGetMetadataParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/FsGetMetadataResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/FsReadDirectoryEntry.js +0 -1
- package/bundle/dist/codex-protocol/v2/FsReadDirectoryParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/FsReadDirectoryResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/FsReadFileParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/FsReadFileResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/FsRemoveParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/FsRemoveResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/FsUnwatchParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/FsUnwatchResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/FsWatchParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/FsWatchResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/FsWriteFileParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/FsWriteFileResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/GetAccountParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/GetAccountRateLimitsResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/GetAccountResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/GitInfo.js +0 -1
- package/bundle/dist/codex-protocol/v2/GrantedPermissionProfile.js +0 -1
- package/bundle/dist/codex-protocol/v2/GuardianApprovalReview.js +0 -1
- package/bundle/dist/codex-protocol/v2/GuardianApprovalReviewAction.js +0 -1
- package/bundle/dist/codex-protocol/v2/GuardianApprovalReviewStatus.js +0 -1
- package/bundle/dist/codex-protocol/v2/GuardianCommandSource.js +0 -1
- package/bundle/dist/codex-protocol/v2/GuardianRiskLevel.js +0 -1
- package/bundle/dist/codex-protocol/v2/GuardianUserAuthorization.js +0 -1
- package/bundle/dist/codex-protocol/v2/GuardianWarningNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/HookCompletedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/HookErrorInfo.js +0 -1
- package/bundle/dist/codex-protocol/v2/HookEventName.js +0 -1
- package/bundle/dist/codex-protocol/v2/HookExecutionMode.js +0 -1
- package/bundle/dist/codex-protocol/v2/HookHandlerType.js +0 -1
- package/bundle/dist/codex-protocol/v2/HookMetadata.js +0 -1
- package/bundle/dist/codex-protocol/v2/HookMigration.js +0 -1
- package/bundle/dist/codex-protocol/v2/HookOutputEntry.js +0 -1
- package/bundle/dist/codex-protocol/v2/HookOutputEntryKind.js +0 -1
- package/bundle/dist/codex-protocol/v2/HookPromptFragment.js +0 -1
- package/bundle/dist/codex-protocol/v2/HookRunStatus.js +0 -1
- package/bundle/dist/codex-protocol/v2/HookRunSummary.js +0 -1
- package/bundle/dist/codex-protocol/v2/HookScope.js +0 -1
- package/bundle/dist/codex-protocol/v2/HookSource.js +0 -1
- package/bundle/dist/codex-protocol/v2/HookStartedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/HookTrustStatus.js +0 -1
- package/bundle/dist/codex-protocol/v2/HooksListEntry.js +0 -1
- package/bundle/dist/codex-protocol/v2/HooksListParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/HooksListResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ItemCompletedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ItemGuardianApprovalReviewCompletedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ItemGuardianApprovalReviewStartedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ItemStartedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ListMcpServerStatusParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ListMcpServerStatusResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/LoginAccountParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/LoginAccountResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/LogoutAccountResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ManagedHooksRequirements.js +0 -1
- package/bundle/dist/codex-protocol/v2/MarketplaceAddParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/MarketplaceAddResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/MarketplaceInterface.js +0 -1
- package/bundle/dist/codex-protocol/v2/MarketplaceLoadErrorInfo.js +0 -1
- package/bundle/dist/codex-protocol/v2/MarketplaceRemoveParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/MarketplaceRemoveResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/MarketplaceUpgradeErrorInfo.js +0 -1
- package/bundle/dist/codex-protocol/v2/MarketplaceUpgradeParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/MarketplaceUpgradeResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpAuthStatus.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpElicitationArrayType.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpElicitationBooleanSchema.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpElicitationBooleanType.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpElicitationConstOption.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpElicitationEnumSchema.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpElicitationLegacyTitledEnumSchema.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpElicitationMultiSelectEnumSchema.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpElicitationNumberSchema.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpElicitationNumberType.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpElicitationObjectType.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpElicitationPrimitiveSchema.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpElicitationSchema.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpElicitationSingleSelectEnumSchema.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpElicitationStringFormat.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpElicitationStringSchema.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpElicitationStringType.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpElicitationTitledEnumItems.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpElicitationTitledMultiSelectEnumSchema.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpElicitationTitledSingleSelectEnumSchema.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpElicitationUntitledEnumItems.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpElicitationUntitledMultiSelectEnumSchema.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpElicitationUntitledSingleSelectEnumSchema.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpResourceReadParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpResourceReadResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpServerElicitationAction.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpServerElicitationRequestParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpServerElicitationRequestResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpServerMigration.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpServerOauthLoginCompletedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpServerOauthLoginParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpServerOauthLoginResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpServerRefreshResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpServerStartupState.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpServerStatus.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpServerStatusDetail.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpServerStatusUpdatedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpServerToolCallParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpServerToolCallResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpToolCallError.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpToolCallProgressNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpToolCallResult.js +0 -1
- package/bundle/dist/codex-protocol/v2/McpToolCallStatus.js +0 -1
- package/bundle/dist/codex-protocol/v2/MemoryCitation.js +0 -1
- package/bundle/dist/codex-protocol/v2/MemoryCitationEntry.js +0 -1
- package/bundle/dist/codex-protocol/v2/MergeStrategy.js +0 -1
- package/bundle/dist/codex-protocol/v2/MigrationDetails.js +0 -1
- package/bundle/dist/codex-protocol/v2/Model.js +0 -1
- package/bundle/dist/codex-protocol/v2/ModelAvailabilityNux.js +0 -1
- package/bundle/dist/codex-protocol/v2/ModelListParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ModelListResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ModelProviderCapabilitiesReadParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ModelProviderCapabilitiesReadResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ModelRerouteReason.js +0 -1
- package/bundle/dist/codex-protocol/v2/ModelReroutedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ModelServiceTier.js +0 -1
- package/bundle/dist/codex-protocol/v2/ModelUpgradeInfo.js +0 -1
- package/bundle/dist/codex-protocol/v2/ModelVerification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ModelVerificationNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/NetworkAccess.js +0 -1
- package/bundle/dist/codex-protocol/v2/NetworkApprovalContext.js +0 -1
- package/bundle/dist/codex-protocol/v2/NetworkApprovalProtocol.js +0 -1
- package/bundle/dist/codex-protocol/v2/NetworkDomainPermission.js +0 -1
- package/bundle/dist/codex-protocol/v2/NetworkPolicyAmendment.js +0 -1
- package/bundle/dist/codex-protocol/v2/NetworkPolicyRuleAction.js +0 -1
- package/bundle/dist/codex-protocol/v2/NetworkRequirements.js +0 -1
- package/bundle/dist/codex-protocol/v2/NetworkUnixSocketPermission.js +0 -1
- package/bundle/dist/codex-protocol/v2/NonSteerableTurnKind.js +0 -1
- package/bundle/dist/codex-protocol/v2/OverriddenMetadata.js +0 -1
- package/bundle/dist/codex-protocol/v2/PatchApplyStatus.js +0 -1
- package/bundle/dist/codex-protocol/v2/PatchChangeKind.js +0 -1
- package/bundle/dist/codex-protocol/v2/PermissionGrantScope.js +0 -1
- package/bundle/dist/codex-protocol/v2/PermissionProfile.js +0 -1
- package/bundle/dist/codex-protocol/v2/PermissionProfileFileSystemPermissions.js +0 -1
- package/bundle/dist/codex-protocol/v2/PermissionProfileModificationParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/PermissionProfileNetworkPermissions.js +0 -1
- package/bundle/dist/codex-protocol/v2/PermissionProfileSelectionParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/PermissionsRequestApprovalParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/PermissionsRequestApprovalResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/PlanDeltaNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginAuthPolicy.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginAvailability.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginDetail.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginHookSummary.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginInstallParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginInstallPolicy.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginInstallResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginInterface.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginListMarketplaceKind.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginListParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginListResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginMarketplaceEntry.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginReadParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginReadResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginShareContext.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginShareDeleteParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginShareDeleteResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginShareDiscoverability.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginShareListItem.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginShareListParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginShareListResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginSharePrincipal.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginSharePrincipalType.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginShareSaveParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginShareSaveResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginShareTarget.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginShareUpdateDiscoverability.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginShareUpdateTargetsParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginShareUpdateTargetsResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginSkillReadParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginSkillReadResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginSource.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginSummary.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginUninstallParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginUninstallResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/PluginsMigration.js +0 -1
- package/bundle/dist/codex-protocol/v2/ProcessExitedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ProcessOutputDeltaNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ProcessOutputStream.js +0 -1
- package/bundle/dist/codex-protocol/v2/ProcessTerminalSize.js +0 -1
- package/bundle/dist/codex-protocol/v2/ProfileV2.js +0 -1
- package/bundle/dist/codex-protocol/v2/RateLimitReachedType.js +0 -1
- package/bundle/dist/codex-protocol/v2/RateLimitSnapshot.js +0 -1
- package/bundle/dist/codex-protocol/v2/RateLimitWindow.js +0 -1
- package/bundle/dist/codex-protocol/v2/RawResponseItemCompletedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ReasoningEffortOption.js +0 -1
- package/bundle/dist/codex-protocol/v2/ReasoningSummaryPartAddedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ReasoningSummaryTextDeltaNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ReasoningTextDeltaNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/RemoteControlConnectionStatus.js +0 -1
- package/bundle/dist/codex-protocol/v2/RemoteControlStatusChangedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/RequestPermissionProfile.js +0 -1
- package/bundle/dist/codex-protocol/v2/ResidencyRequirement.js +0 -1
- package/bundle/dist/codex-protocol/v2/ReviewDelivery.js +0 -1
- package/bundle/dist/codex-protocol/v2/ReviewStartParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ReviewStartResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ReviewTarget.js +0 -1
- package/bundle/dist/codex-protocol/v2/SandboxMode.js +0 -1
- package/bundle/dist/codex-protocol/v2/SandboxPolicy.js +0 -1
- package/bundle/dist/codex-protocol/v2/SandboxWorkspaceWrite.js +0 -1
- package/bundle/dist/codex-protocol/v2/SendAddCreditsNudgeEmailParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/SendAddCreditsNudgeEmailResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ServerRequestResolvedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/SessionMigration.js +0 -1
- package/bundle/dist/codex-protocol/v2/SessionSource.js +0 -1
- package/bundle/dist/codex-protocol/v2/SkillDependencies.js +0 -1
- package/bundle/dist/codex-protocol/v2/SkillErrorInfo.js +0 -1
- package/bundle/dist/codex-protocol/v2/SkillInterface.js +0 -1
- package/bundle/dist/codex-protocol/v2/SkillMetadata.js +0 -1
- package/bundle/dist/codex-protocol/v2/SkillScope.js +0 -1
- package/bundle/dist/codex-protocol/v2/SkillSummary.js +0 -1
- package/bundle/dist/codex-protocol/v2/SkillToolDependency.js +0 -1
- package/bundle/dist/codex-protocol/v2/SkillsChangedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/SkillsConfigWriteParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/SkillsConfigWriteResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/SkillsListEntry.js +0 -1
- package/bundle/dist/codex-protocol/v2/SkillsListParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/SkillsListResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/SortDirection.js +0 -1
- package/bundle/dist/codex-protocol/v2/SubagentMigration.js +0 -1
- package/bundle/dist/codex-protocol/v2/TerminalInteractionNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/TextElement.js +0 -1
- package/bundle/dist/codex-protocol/v2/TextPosition.js +0 -1
- package/bundle/dist/codex-protocol/v2/TextRange.js +0 -1
- package/bundle/dist/codex-protocol/v2/Thread.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadActiveFlag.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadApproveGuardianDeniedActionParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadApproveGuardianDeniedActionResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadArchiveParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadArchiveResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadArchivedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadClosedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadCompactStartParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadCompactStartResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadForkParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadForkResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadGoal.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadGoalClearedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadGoalStatus.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadGoalUpdatedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadInjectItemsParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadInjectItemsResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadItem.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadListParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadListResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadLoadedListParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadLoadedListResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadMetadataGitInfoUpdateParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadMetadataUpdateParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadMetadataUpdateResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadNameUpdatedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadReadParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadReadResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadRealtimeAudioChunk.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadRealtimeClosedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadRealtimeErrorNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadRealtimeItemAddedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadRealtimeOutputAudioDeltaNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadRealtimeSdpNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadRealtimeStartTransport.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadRealtimeStartedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadRealtimeTranscriptDeltaNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadRealtimeTranscriptDoneNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadResumeParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadResumeResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadRollbackParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadRollbackResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadSetNameParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadSetNameResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadShellCommandParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadShellCommandResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadSortKey.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadSource.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadSourceKind.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadStartParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadStartResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadStartSource.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadStartedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadStatus.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadStatusChangedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadTokenUsage.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadTokenUsageUpdatedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadUnarchiveParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadUnarchiveResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadUnarchivedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadUnsubscribeParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadUnsubscribeResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ThreadUnsubscribeStatus.js +0 -1
- package/bundle/dist/codex-protocol/v2/TokenUsageBreakdown.js +0 -1
- package/bundle/dist/codex-protocol/v2/ToolRequestUserInputAnswer.js +0 -1
- package/bundle/dist/codex-protocol/v2/ToolRequestUserInputOption.js +0 -1
- package/bundle/dist/codex-protocol/v2/ToolRequestUserInputParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/ToolRequestUserInputQuestion.js +0 -1
- package/bundle/dist/codex-protocol/v2/ToolRequestUserInputResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/ToolsV2.js +0 -1
- package/bundle/dist/codex-protocol/v2/Turn.js +0 -1
- package/bundle/dist/codex-protocol/v2/TurnCompletedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/TurnDiffUpdatedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/TurnEnvironmentParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/TurnError.js +0 -1
- package/bundle/dist/codex-protocol/v2/TurnInterruptParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/TurnInterruptResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/TurnItemsView.js +0 -1
- package/bundle/dist/codex-protocol/v2/TurnPlanStep.js +0 -1
- package/bundle/dist/codex-protocol/v2/TurnPlanStepStatus.js +0 -1
- package/bundle/dist/codex-protocol/v2/TurnPlanUpdatedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/TurnStartParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/TurnStartResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/TurnStartedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/TurnStatus.js +0 -1
- package/bundle/dist/codex-protocol/v2/TurnSteerParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/TurnSteerResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/UserInput.js +0 -1
- package/bundle/dist/codex-protocol/v2/WarningNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/WebSearchAction.js +0 -1
- package/bundle/dist/codex-protocol/v2/WindowsSandboxReadiness.js +0 -1
- package/bundle/dist/codex-protocol/v2/WindowsSandboxReadinessResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/WindowsSandboxSetupCompletedNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/WindowsSandboxSetupMode.js +0 -1
- package/bundle/dist/codex-protocol/v2/WindowsSandboxSetupStartParams.js +0 -1
- package/bundle/dist/codex-protocol/v2/WindowsSandboxSetupStartResponse.js +0 -1
- package/bundle/dist/codex-protocol/v2/WindowsWorldWritableWarningNotification.js +0 -1
- package/bundle/dist/codex-protocol/v2/WriteStatus.js +0 -1
- package/bundle/dist/codex-protocol/v2/index.js +0 -7
- package/bundle/dist/utils/providers/openai/codex-rpc.js +0 -153
- package/bundle/dist/utils/providers/openai/codex-worker.js +0 -642
- package/bundle/dist/utils/providers/openai/openai-worker-pool-config.js +0 -51
- package/bundle/src/codex-protocol/AbsolutePathBuf.ts +0 -14
- package/bundle/src/codex-protocol/AgentPath.ts +0 -5
- package/bundle/src/codex-protocol/ApplyPatchApprovalParams.ts +0 -24
- package/bundle/src/codex-protocol/ApplyPatchApprovalResponse.ts +0 -6
- package/bundle/src/codex-protocol/AuthMode.ts +0 -8
- package/bundle/src/codex-protocol/ClientInfo.ts +0 -5
- package/bundle/src/codex-protocol/ClientNotification.ts +0 -5
- package/bundle/src/codex-protocol/ClientRequest.ts +0 -176
- package/bundle/src/codex-protocol/CollaborationMode.ts +0 -10
- package/bundle/src/codex-protocol/ContentItem.ts +0 -9
- package/bundle/src/codex-protocol/ConversationGitInfo.ts +0 -9
- package/bundle/src/codex-protocol/ConversationSummary.ts +0 -19
- package/bundle/src/codex-protocol/ExecCommandApprovalParams.ts +0 -22
- package/bundle/src/codex-protocol/ExecCommandApprovalResponse.ts +0 -6
- package/bundle/src/codex-protocol/ExecPolicyAmendment.ts +0 -12
- package/bundle/src/codex-protocol/FileChange.ts +0 -8
- package/bundle/src/codex-protocol/ForcedLoginMethod.ts +0 -5
- package/bundle/src/codex-protocol/FunctionCallOutputBody.ts +0 -6
- package/bundle/src/codex-protocol/FunctionCallOutputContentItem.ts +0 -12
- package/bundle/src/codex-protocol/FuzzyFileSearchMatchType.ts +0 -5
- package/bundle/src/codex-protocol/FuzzyFileSearchParams.ts +0 -9
- package/bundle/src/codex-protocol/FuzzyFileSearchResponse.ts +0 -6
- package/bundle/src/codex-protocol/FuzzyFileSearchResult.ts +0 -16
- package/bundle/src/codex-protocol/FuzzyFileSearchSessionCompletedNotification.ts +0 -5
- package/bundle/src/codex-protocol/FuzzyFileSearchSessionUpdatedNotification.ts +0 -10
- package/bundle/src/codex-protocol/GetAuthStatusParams.ts +0 -5
- package/bundle/src/codex-protocol/GetAuthStatusResponse.ts +0 -10
- package/bundle/src/codex-protocol/GetConversationSummaryParams.ts +0 -6
- package/bundle/src/codex-protocol/GetConversationSummaryResponse.ts +0 -6
- package/bundle/src/codex-protocol/GitDiffToRemoteParams.ts +0 -5
- package/bundle/src/codex-protocol/GitDiffToRemoteResponse.ts +0 -6
- package/bundle/src/codex-protocol/GitSha.ts +0 -5
- package/bundle/src/codex-protocol/ImageDetail.ts +0 -5
- package/bundle/src/codex-protocol/InitializeCapabilities.ts +0 -18
- package/bundle/src/codex-protocol/InitializeParams.ts +0 -10
- package/bundle/src/codex-protocol/InitializeResponse.ts +0 -22
- package/bundle/src/codex-protocol/InputModality.ts +0 -8
- package/bundle/src/codex-protocol/InternalSessionSource.ts +0 -5
- package/bundle/src/codex-protocol/LocalShellAction.ts +0 -6
- package/bundle/src/codex-protocol/LocalShellExecAction.ts +0 -11
- package/bundle/src/codex-protocol/LocalShellStatus.ts +0 -5
- package/bundle/src/codex-protocol/MessagePhase.ts +0 -11
- package/bundle/src/codex-protocol/ModeKind.ts +0 -8
- package/bundle/src/codex-protocol/NetworkPolicyAmendment.ts +0 -6
- package/bundle/src/codex-protocol/NetworkPolicyRuleAction.ts +0 -5
- package/bundle/src/codex-protocol/ParsedCommand.ts +0 -20
- package/bundle/src/codex-protocol/Personality.ts +0 -5
- package/bundle/src/codex-protocol/PlanType.ts +0 -17
- package/bundle/src/codex-protocol/RealtimeConversationVersion.ts +0 -5
- package/bundle/src/codex-protocol/RealtimeOutputModality.ts +0 -5
- package/bundle/src/codex-protocol/RealtimeVoice.ts +0 -24
- package/bundle/src/codex-protocol/RealtimeVoicesList.ts +0 -11
- package/bundle/src/codex-protocol/ReasoningEffort.ts +0 -8
- package/bundle/src/codex-protocol/ReasoningItemContent.ts +0 -7
- package/bundle/src/codex-protocol/ReasoningItemReasoningSummary.ts +0 -5
- package/bundle/src/codex-protocol/ReasoningSummary.ts +0 -10
- package/bundle/src/codex-protocol/RequestId.ts +0 -5
- package/bundle/src/codex-protocol/Resource.ts +0 -19
- package/bundle/src/codex-protocol/ResourceContent.ts +0 -27
- package/bundle/src/codex-protocol/ResourceTemplate.ts +0 -16
- package/bundle/src/codex-protocol/ResponseItem.ts +0 -63
- package/bundle/src/codex-protocol/ReviewDecision.ts +0 -17
- package/bundle/src/codex-protocol/ServerNotification.ts +0 -154
- package/bundle/src/codex-protocol/ServerRequest.ts +0 -47
- package/bundle/src/codex-protocol/SessionSource.ts +0 -15
- package/bundle/src/codex-protocol/Settings.ts +0 -13
- package/bundle/src/codex-protocol/SubAgentSource.ts +0 -20
- package/bundle/src/codex-protocol/ThreadId.ts +0 -5
- package/bundle/src/codex-protocol/ThreadMemoryMode.ts +0 -5
- package/bundle/src/codex-protocol/Tool.ts +0 -18
- package/bundle/src/codex-protocol/Verbosity.ts +0 -9
- package/bundle/src/codex-protocol/WebSearchAction.ts +0 -9
- package/bundle/src/codex-protocol/WebSearchContextSize.ts +0 -5
- package/bundle/src/codex-protocol/WebSearchLocation.ts +0 -10
- package/bundle/src/codex-protocol/WebSearchMode.ts +0 -5
- package/bundle/src/codex-protocol/WebSearchToolConfig.ts +0 -11
- package/bundle/src/codex-protocol/index.ts +0 -79
- package/bundle/src/codex-protocol/serde_json/JsonValue.ts +0 -11
- package/bundle/src/codex-protocol/v2/Account.ts +0 -9
- package/bundle/src/codex-protocol/v2/AccountLoginCompletedNotification.ts +0 -9
- package/bundle/src/codex-protocol/v2/AccountRateLimitsUpdatedNotification.ts +0 -6
- package/bundle/src/codex-protocol/v2/AccountUpdatedNotification.ts +0 -7
- package/bundle/src/codex-protocol/v2/ActivePermissionProfile.ts +0 -22
- package/bundle/src/codex-protocol/v2/ActivePermissionProfileModification.ts +0 -9
- package/bundle/src/codex-protocol/v2/AddCreditsNudgeCreditType.ts +0 -5
- package/bundle/src/codex-protocol/v2/AddCreditsNudgeEmailStatus.ts +0 -5
- package/bundle/src/codex-protocol/v2/AdditionalFileSystemPermissions.ts +0 -18
- package/bundle/src/codex-protocol/v2/AdditionalNetworkPermissions.ts +0 -5
- package/bundle/src/codex-protocol/v2/AdditionalPermissionProfile.ts +0 -13
- package/bundle/src/codex-protocol/v2/AgentMessageDeltaNotification.ts +0 -10
- package/bundle/src/codex-protocol/v2/AnalyticsConfig.ts +0 -14
- package/bundle/src/codex-protocol/v2/AppBranding.ts +0 -15
- package/bundle/src/codex-protocol/v2/AppInfo.ts +0 -32
- package/bundle/src/codex-protocol/v2/AppListUpdatedNotification.ts +0 -9
- package/bundle/src/codex-protocol/v2/AppMetadata.ts +0 -20
- package/bundle/src/codex-protocol/v2/AppReview.ts +0 -5
- package/bundle/src/codex-protocol/v2/AppScreenshot.ts +0 -5
- package/bundle/src/codex-protocol/v2/AppSummary.ts +0 -14
- package/bundle/src/codex-protocol/v2/AppToolApproval.ts +0 -5
- package/bundle/src/codex-protocol/v2/AppToolsConfig.ts +0 -8
- package/bundle/src/codex-protocol/v2/ApprovalsReviewer.ts +0 -12
- package/bundle/src/codex-protocol/v2/AppsConfig.ts +0 -17
- package/bundle/src/codex-protocol/v2/AppsDefaultConfig.ts +0 -9
- package/bundle/src/codex-protocol/v2/AppsListParams.ts +0 -25
- package/bundle/src/codex-protocol/v2/AppsListResponse.ts +0 -16
- package/bundle/src/codex-protocol/v2/AskForApproval.ts +0 -18
- package/bundle/src/codex-protocol/v2/AutoReviewDecisionSource.ts +0 -8
- package/bundle/src/codex-protocol/v2/ByteRange.ts +0 -5
- package/bundle/src/codex-protocol/v2/CancelLoginAccountParams.ts +0 -5
- package/bundle/src/codex-protocol/v2/CancelLoginAccountResponse.ts +0 -6
- package/bundle/src/codex-protocol/v2/CancelLoginAccountStatus.ts +0 -5
- package/bundle/src/codex-protocol/v2/ChatgptAuthTokensRefreshParams.ts +0 -18
- package/bundle/src/codex-protocol/v2/ChatgptAuthTokensRefreshReason.ts +0 -5
- package/bundle/src/codex-protocol/v2/ChatgptAuthTokensRefreshResponse.ts +0 -9
- package/bundle/src/codex-protocol/v2/CodexErrorInfo.ts +0 -27
- package/bundle/src/codex-protocol/v2/CollabAgentState.ts +0 -6
- package/bundle/src/codex-protocol/v2/CollabAgentStatus.ts +0 -12
- package/bundle/src/codex-protocol/v2/CollabAgentTool.ts +0 -5
- package/bundle/src/codex-protocol/v2/CollabAgentToolCallStatus.ts +0 -5
- package/bundle/src/codex-protocol/v2/CollaborationModeMask.ts +0 -15
- package/bundle/src/codex-protocol/v2/CommandAction.ts +0 -10
- package/bundle/src/codex-protocol/v2/CommandExecOutputDeltaNotification.ts +0 -31
- package/bundle/src/codex-protocol/v2/CommandExecOutputStream.ts +0 -8
- package/bundle/src/codex-protocol/v2/CommandExecParams.ts +0 -87
- package/bundle/src/codex-protocol/v2/CommandExecResizeParams.ts +0 -19
- package/bundle/src/codex-protocol/v2/CommandExecResizeResponse.ts +0 -8
- package/bundle/src/codex-protocol/v2/CommandExecResponse.ts +0 -25
- package/bundle/src/codex-protocol/v2/CommandExecTerminalSize.ts +0 -17
- package/bundle/src/codex-protocol/v2/CommandExecTerminateParams.ts +0 -14
- package/bundle/src/codex-protocol/v2/CommandExecTerminateResponse.ts +0 -8
- package/bundle/src/codex-protocol/v2/CommandExecWriteParams.ts +0 -23
- package/bundle/src/codex-protocol/v2/CommandExecWriteResponse.ts +0 -8
- package/bundle/src/codex-protocol/v2/CommandExecutionApprovalDecision.ts +0 -13
- package/bundle/src/codex-protocol/v2/CommandExecutionOutputDeltaNotification.ts +0 -10
- package/bundle/src/codex-protocol/v2/CommandExecutionRequestApprovalParams.ts +0 -47
- package/bundle/src/codex-protocol/v2/CommandExecutionRequestApprovalResponse.ts +0 -8
- package/bundle/src/codex-protocol/v2/CommandExecutionSource.ts +0 -9
- package/bundle/src/codex-protocol/v2/CommandExecutionStatus.ts +0 -5
- package/bundle/src/codex-protocol/v2/CommandMigration.ts +0 -5
- package/bundle/src/codex-protocol/v2/Config.ts +0 -53
- package/bundle/src/codex-protocol/v2/ConfigBatchWriteParams.ts +0 -17
- package/bundle/src/codex-protocol/v2/ConfigEdit.ts +0 -7
- package/bundle/src/codex-protocol/v2/ConfigLayer.ts +0 -12
- package/bundle/src/codex-protocol/v2/ConfigLayerMetadata.ts +0 -6
- package/bundle/src/codex-protocol/v2/ConfigLayerSource.ts +0 -27
- package/bundle/src/codex-protocol/v2/ConfigReadParams.ts +0 -13
- package/bundle/src/codex-protocol/v2/ConfigReadResponse.ts +0 -12
- package/bundle/src/codex-protocol/v2/ConfigRequirements.ts +0 -15
- package/bundle/src/codex-protocol/v2/ConfigRequirementsReadResponse.ts +0 -11
- package/bundle/src/codex-protocol/v2/ConfigValueWriteParams.ts +0 -16
- package/bundle/src/codex-protocol/v2/ConfigWarningNotification.ts +0 -23
- package/bundle/src/codex-protocol/v2/ConfigWriteResponse.ts +0 -16
- package/bundle/src/codex-protocol/v2/ConfiguredHookHandler.ts +0 -14
- package/bundle/src/codex-protocol/v2/ConfiguredHookMatcherGroup.ts +0 -9
- package/bundle/src/codex-protocol/v2/ContextCompactedNotification.ts +0 -8
- package/bundle/src/codex-protocol/v2/CreditsSnapshot.ts +0 -5
- package/bundle/src/codex-protocol/v2/DeprecationNoticeNotification.ts +0 -14
- package/bundle/src/codex-protocol/v2/DynamicToolCallOutputContentItem.ts +0 -7
- package/bundle/src/codex-protocol/v2/DynamicToolCallParams.ts +0 -13
- package/bundle/src/codex-protocol/v2/DynamicToolCallResponse.ts +0 -9
- package/bundle/src/codex-protocol/v2/DynamicToolCallStatus.ts +0 -5
- package/bundle/src/codex-protocol/v2/DynamicToolSpec.ts +0 -12
- package/bundle/src/codex-protocol/v2/ErrorNotification.ts +0 -11
- package/bundle/src/codex-protocol/v2/ExecPolicyAmendment.ts +0 -5
- package/bundle/src/codex-protocol/v2/ExperimentalFeature.ts +0 -38
- package/bundle/src/codex-protocol/v2/ExperimentalFeatureEnablementSetParams.ts +0 -13
- package/bundle/src/codex-protocol/v2/ExperimentalFeatureEnablementSetResponse.ts +0 -10
- package/bundle/src/codex-protocol/v2/ExperimentalFeatureListParams.ts +0 -14
- package/bundle/src/codex-protocol/v2/ExperimentalFeatureListResponse.ts +0 -13
- package/bundle/src/codex-protocol/v2/ExperimentalFeatureStage.ts +0 -10
- package/bundle/src/codex-protocol/v2/ExternalAgentConfigDetectParams.ts +0 -14
- package/bundle/src/codex-protocol/v2/ExternalAgentConfigDetectResponse.ts +0 -6
- package/bundle/src/codex-protocol/v2/ExternalAgentConfigImportCompletedNotification.ts +0 -5
- package/bundle/src/codex-protocol/v2/ExternalAgentConfigImportParams.ts +0 -8
- package/bundle/src/codex-protocol/v2/ExternalAgentConfigImportResponse.ts +0 -5
- package/bundle/src/codex-protocol/v2/ExternalAgentConfigMigrationItem.ts +0 -15
- package/bundle/src/codex-protocol/v2/ExternalAgentConfigMigrationItemType.ts +0 -14
- package/bundle/src/codex-protocol/v2/FeedbackUploadParams.ts +0 -12
- package/bundle/src/codex-protocol/v2/FeedbackUploadResponse.ts +0 -5
- package/bundle/src/codex-protocol/v2/FileChangeApprovalDecision.ts +0 -5
- package/bundle/src/codex-protocol/v2/FileChangeOutputDeltaNotification.ts +0 -15
- package/bundle/src/codex-protocol/v2/FileChangePatchUpdatedNotification.ts +0 -11
- package/bundle/src/codex-protocol/v2/FileChangeRequestApprovalParams.ts +0 -22
- package/bundle/src/codex-protocol/v2/FileChangeRequestApprovalResponse.ts +0 -6
- package/bundle/src/codex-protocol/v2/FileSystemAccessMode.ts +0 -5
- package/bundle/src/codex-protocol/v2/FileSystemPath.ts +0 -10
- package/bundle/src/codex-protocol/v2/FileSystemSandboxEntry.ts +0 -7
- package/bundle/src/codex-protocol/v2/FileSystemSpecialPath.ts +0 -11
- package/bundle/src/codex-protocol/v2/FileUpdateChange.ts +0 -6
- package/bundle/src/codex-protocol/v2/FsChangedNotification.ts +0 -18
- package/bundle/src/codex-protocol/v2/FsCopyParams.ts +0 -22
- package/bundle/src/codex-protocol/v2/FsCopyResponse.ts +0 -8
- package/bundle/src/codex-protocol/v2/FsCreateDirectoryParams.ts +0 -18
- package/bundle/src/codex-protocol/v2/FsCreateDirectoryResponse.ts +0 -8
- package/bundle/src/codex-protocol/v2/FsGetMetadataParams.ts +0 -14
- package/bundle/src/codex-protocol/v2/FsGetMetadataResponse.ts +0 -29
- package/bundle/src/codex-protocol/v2/FsReadDirectoryEntry.ts +0 -21
- package/bundle/src/codex-protocol/v2/FsReadDirectoryParams.ts +0 -14
- package/bundle/src/codex-protocol/v2/FsReadDirectoryResponse.ts +0 -14
- package/bundle/src/codex-protocol/v2/FsReadFileParams.ts +0 -14
- package/bundle/src/codex-protocol/v2/FsReadFileResponse.ts +0 -13
- package/bundle/src/codex-protocol/v2/FsRemoveParams.ts +0 -22
- package/bundle/src/codex-protocol/v2/FsRemoveResponse.ts +0 -8
- package/bundle/src/codex-protocol/v2/FsUnwatchParams.ts +0 -13
- package/bundle/src/codex-protocol/v2/FsUnwatchResponse.ts +0 -8
- package/bundle/src/codex-protocol/v2/FsWatchParams.ts +0 -18
- package/bundle/src/codex-protocol/v2/FsWatchResponse.ts +0 -14
- package/bundle/src/codex-protocol/v2/FsWriteFileParams.ts +0 -18
- package/bundle/src/codex-protocol/v2/FsWriteFileResponse.ts +0 -8
- package/bundle/src/codex-protocol/v2/GetAccountParams.ts +0 -14
- package/bundle/src/codex-protocol/v2/GetAccountRateLimitsResponse.ts +0 -15
- package/bundle/src/codex-protocol/v2/GetAccountResponse.ts +0 -6
- package/bundle/src/codex-protocol/v2/GitInfo.ts +0 -5
- package/bundle/src/codex-protocol/v2/GrantedPermissionProfile.ts +0 -10
- package/bundle/src/codex-protocol/v2/GuardianApprovalReview.ts +0 -18
- package/bundle/src/codex-protocol/v2/GuardianApprovalReviewAction.ts +0 -34
- package/bundle/src/codex-protocol/v2/GuardianApprovalReviewStatus.ts +0 -13
- package/bundle/src/codex-protocol/v2/GuardianCommandSource.ts +0 -5
- package/bundle/src/codex-protocol/v2/GuardianRiskLevel.ts +0 -8
- package/bundle/src/codex-protocol/v2/GuardianUserAuthorization.ts +0 -8
- package/bundle/src/codex-protocol/v2/GuardianWarningNotification.ts +0 -14
- package/bundle/src/codex-protocol/v2/HookCompletedNotification.ts +0 -10
- package/bundle/src/codex-protocol/v2/HookErrorInfo.ts +0 -5
- package/bundle/src/codex-protocol/v2/HookEventName.ts +0 -13
- package/bundle/src/codex-protocol/v2/HookExecutionMode.ts +0 -5
- package/bundle/src/codex-protocol/v2/HookHandlerType.ts +0 -5
- package/bundle/src/codex-protocol/v2/HookMetadata.ts +0 -26
- package/bundle/src/codex-protocol/v2/HookMigration.ts +0 -5
- package/bundle/src/codex-protocol/v2/HookOutputEntry.ts +0 -6
- package/bundle/src/codex-protocol/v2/HookOutputEntryKind.ts +0 -5
- package/bundle/src/codex-protocol/v2/HookPromptFragment.ts +0 -5
- package/bundle/src/codex-protocol/v2/HookRunStatus.ts +0 -5
- package/bundle/src/codex-protocol/v2/HookRunSummary.ts +0 -28
- package/bundle/src/codex-protocol/v2/HookScope.ts +0 -5
- package/bundle/src/codex-protocol/v2/HookSource.ts +0 -15
- package/bundle/src/codex-protocol/v2/HookStartedNotification.ts +0 -10
- package/bundle/src/codex-protocol/v2/HookTrustStatus.ts +0 -5
- package/bundle/src/codex-protocol/v2/HooksListEntry.ts +0 -12
- package/bundle/src/codex-protocol/v2/HooksListParams.ts +0 -10
- package/bundle/src/codex-protocol/v2/HooksListResponse.ts +0 -6
- package/bundle/src/codex-protocol/v2/ItemCompletedNotification.ts +0 -14
- package/bundle/src/codex-protocol/v2/ItemGuardianApprovalReviewCompletedNotification.ts +0 -44
- package/bundle/src/codex-protocol/v2/ItemGuardianApprovalReviewStartedNotification.ts +0 -38
- package/bundle/src/codex-protocol/v2/ItemStartedNotification.ts +0 -14
- package/bundle/src/codex-protocol/v2/ListMcpServerStatusParams.ts +0 -20
- package/bundle/src/codex-protocol/v2/ListMcpServerStatusResponse.ts +0 -13
- package/bundle/src/codex-protocol/v2/LoginAccountParams.ts +0 -27
- package/bundle/src/codex-protocol/v2/LoginAccountResponse.ts +0 -27
- package/bundle/src/codex-protocol/v2/LogoutAccountResponse.ts +0 -5
- package/bundle/src/codex-protocol/v2/ManagedHooksRequirements.ts +0 -17
- package/bundle/src/codex-protocol/v2/MarketplaceAddParams.ts +0 -9
- package/bundle/src/codex-protocol/v2/MarketplaceAddResponse.ts +0 -10
- package/bundle/src/codex-protocol/v2/MarketplaceInterface.ts +0 -5
- package/bundle/src/codex-protocol/v2/MarketplaceLoadErrorInfo.ts +0 -6
- package/bundle/src/codex-protocol/v2/MarketplaceRemoveParams.ts +0 -5
- package/bundle/src/codex-protocol/v2/MarketplaceRemoveResponse.ts +0 -9
- package/bundle/src/codex-protocol/v2/MarketplaceUpgradeErrorInfo.ts +0 -5
- package/bundle/src/codex-protocol/v2/MarketplaceUpgradeParams.ts +0 -5
- package/bundle/src/codex-protocol/v2/MarketplaceUpgradeResponse.ts +0 -11
- package/bundle/src/codex-protocol/v2/McpAuthStatus.ts +0 -5
- package/bundle/src/codex-protocol/v2/McpElicitationArrayType.ts +0 -5
- package/bundle/src/codex-protocol/v2/McpElicitationBooleanSchema.ts +0 -11
- package/bundle/src/codex-protocol/v2/McpElicitationBooleanType.ts +0 -5
- package/bundle/src/codex-protocol/v2/McpElicitationConstOption.ts +0 -5
- package/bundle/src/codex-protocol/v2/McpElicitationEnumSchema.ts +0 -11
- package/bundle/src/codex-protocol/v2/McpElicitationLegacyTitledEnumSchema.ts +0 -13
- package/bundle/src/codex-protocol/v2/McpElicitationMultiSelectEnumSchema.ts +0 -9
- package/bundle/src/codex-protocol/v2/McpElicitationNumberSchema.ts +0 -13
- package/bundle/src/codex-protocol/v2/McpElicitationNumberType.ts +0 -5
- package/bundle/src/codex-protocol/v2/McpElicitationObjectType.ts +0 -5
- package/bundle/src/codex-protocol/v2/McpElicitationPrimitiveSchema.ts +0 -13
- package/bundle/src/codex-protocol/v2/McpElicitationSchema.ts +0 -18
- package/bundle/src/codex-protocol/v2/McpElicitationSingleSelectEnumSchema.ts +0 -9
- package/bundle/src/codex-protocol/v2/McpElicitationStringFormat.ts +0 -5
- package/bundle/src/codex-protocol/v2/McpElicitationStringSchema.ts +0 -15
- package/bundle/src/codex-protocol/v2/McpElicitationStringType.ts +0 -5
- package/bundle/src/codex-protocol/v2/McpElicitationTitledEnumItems.ts +0 -6
- package/bundle/src/codex-protocol/v2/McpElicitationTitledMultiSelectEnumSchema.ts +0 -15
- package/bundle/src/codex-protocol/v2/McpElicitationTitledSingleSelectEnumSchema.ts +0 -13
- package/bundle/src/codex-protocol/v2/McpElicitationUntitledEnumItems.ts +0 -9
- package/bundle/src/codex-protocol/v2/McpElicitationUntitledMultiSelectEnumSchema.ts +0 -15
- package/bundle/src/codex-protocol/v2/McpElicitationUntitledSingleSelectEnumSchema.ts +0 -12
- package/bundle/src/codex-protocol/v2/McpResourceReadParams.ts +0 -5
- package/bundle/src/codex-protocol/v2/McpResourceReadResponse.ts +0 -6
- package/bundle/src/codex-protocol/v2/McpServerElicitationAction.ts +0 -5
- package/bundle/src/codex-protocol/v2/McpServerElicitationRequestParams.ts +0 -27
- package/bundle/src/codex-protocol/v2/McpServerElicitationRequestResponse.ts +0 -19
- package/bundle/src/codex-protocol/v2/McpServerMigration.ts +0 -5
- package/bundle/src/codex-protocol/v2/McpServerOauthLoginCompletedNotification.ts +0 -9
- package/bundle/src/codex-protocol/v2/McpServerOauthLoginParams.ts +0 -9
- package/bundle/src/codex-protocol/v2/McpServerOauthLoginResponse.ts +0 -5
- package/bundle/src/codex-protocol/v2/McpServerRefreshResponse.ts +0 -5
- package/bundle/src/codex-protocol/v2/McpServerStartupState.ts +0 -5
- package/bundle/src/codex-protocol/v2/McpServerStatus.ts +0 -15
- package/bundle/src/codex-protocol/v2/McpServerStatusDetail.ts +0 -5
- package/bundle/src/codex-protocol/v2/McpServerStatusUpdatedNotification.ts +0 -10
- package/bundle/src/codex-protocol/v2/McpServerToolCallParams.ts +0 -12
- package/bundle/src/codex-protocol/v2/McpServerToolCallResponse.ts +0 -11
- package/bundle/src/codex-protocol/v2/McpToolCallError.ts +0 -5
- package/bundle/src/codex-protocol/v2/McpToolCallProgressNotification.ts +0 -10
- package/bundle/src/codex-protocol/v2/McpToolCallResult.ts +0 -10
- package/bundle/src/codex-protocol/v2/McpToolCallStatus.ts +0 -5
- package/bundle/src/codex-protocol/v2/MemoryCitation.ts +0 -6
- package/bundle/src/codex-protocol/v2/MemoryCitationEntry.ts +0 -10
- package/bundle/src/codex-protocol/v2/MergeStrategy.ts +0 -5
- package/bundle/src/codex-protocol/v2/MigrationDetails.ts +0 -18
- package/bundle/src/codex-protocol/v2/Model.ts +0 -30
- package/bundle/src/codex-protocol/v2/ModelAvailabilityNux.ts +0 -5
- package/bundle/src/codex-protocol/v2/ModelListParams.ts +0 -18
- package/bundle/src/codex-protocol/v2/ModelListResponse.ts +0 -13
- package/bundle/src/codex-protocol/v2/ModelProviderCapabilitiesReadParams.ts +0 -5
- package/bundle/src/codex-protocol/v2/ModelProviderCapabilitiesReadResponse.ts +0 -9
- package/bundle/src/codex-protocol/v2/ModelRerouteReason.ts +0 -5
- package/bundle/src/codex-protocol/v2/ModelReroutedNotification.ts +0 -12
- package/bundle/src/codex-protocol/v2/ModelServiceTier.ts +0 -5
- package/bundle/src/codex-protocol/v2/ModelUpgradeInfo.ts +0 -10
- package/bundle/src/codex-protocol/v2/ModelVerification.ts +0 -5
- package/bundle/src/codex-protocol/v2/ModelVerificationNotification.ts +0 -10
- package/bundle/src/codex-protocol/v2/NetworkAccess.ts +0 -5
- package/bundle/src/codex-protocol/v2/NetworkApprovalContext.ts +0 -6
- package/bundle/src/codex-protocol/v2/NetworkApprovalProtocol.ts +0 -5
- package/bundle/src/codex-protocol/v2/NetworkDomainPermission.ts +0 -5
- package/bundle/src/codex-protocol/v2/NetworkPolicyAmendment.ts +0 -6
- package/bundle/src/codex-protocol/v2/NetworkPolicyRuleAction.ts +0 -5
- package/bundle/src/codex-protocol/v2/NetworkRequirements.ts +0 -40
- package/bundle/src/codex-protocol/v2/NetworkUnixSocketPermission.ts +0 -5
- package/bundle/src/codex-protocol/v2/NonSteerableTurnKind.ts +0 -5
- package/bundle/src/codex-protocol/v2/OverriddenMetadata.ts +0 -11
- package/bundle/src/codex-protocol/v2/PatchApplyStatus.ts +0 -5
- package/bundle/src/codex-protocol/v2/PatchChangeKind.ts +0 -8
- package/bundle/src/codex-protocol/v2/PermissionGrantScope.ts +0 -5
- package/bundle/src/codex-protocol/v2/PermissionProfile.ts +0 -14
- package/bundle/src/codex-protocol/v2/PermissionProfileFileSystemPermissions.ts +0 -8
- package/bundle/src/codex-protocol/v2/PermissionProfileModificationParams.ts +0 -9
- package/bundle/src/codex-protocol/v2/PermissionProfileNetworkPermissions.ts +0 -5
- package/bundle/src/codex-protocol/v2/PermissionProfileSelectionParams.ts +0 -10
- package/bundle/src/codex-protocol/v2/PermissionsRequestApprovalParams.ts +0 -18
- package/bundle/src/codex-protocol/v2/PermissionsRequestApprovalResponse.ts +0 -14
- package/bundle/src/codex-protocol/v2/PlanDeltaNotification.ts +0 -14
- package/bundle/src/codex-protocol/v2/PluginAuthPolicy.ts +0 -5
- package/bundle/src/codex-protocol/v2/PluginAvailability.ts +0 -5
- package/bundle/src/codex-protocol/v2/PluginDetail.ts +0 -19
- package/bundle/src/codex-protocol/v2/PluginHookSummary.ts +0 -6
- package/bundle/src/codex-protocol/v2/PluginInstallParams.ts +0 -10
- package/bundle/src/codex-protocol/v2/PluginInstallPolicy.ts +0 -5
- package/bundle/src/codex-protocol/v2/PluginInstallResponse.ts +0 -10
- package/bundle/src/codex-protocol/v2/PluginInterface.ts +0 -46
- package/bundle/src/codex-protocol/v2/PluginListMarketplaceKind.ts +0 -5
- package/bundle/src/codex-protocol/v2/PluginListParams.ts +0 -18
- package/bundle/src/codex-protocol/v2/PluginListResponse.ts +0 -11
- package/bundle/src/codex-protocol/v2/PluginMarketplaceEntry.ts +0 -17
- package/bundle/src/codex-protocol/v2/PluginReadParams.ts +0 -10
- package/bundle/src/codex-protocol/v2/PluginReadResponse.ts +0 -6
- package/bundle/src/codex-protocol/v2/PluginShareContext.ts +0 -12
- package/bundle/src/codex-protocol/v2/PluginShareDeleteParams.ts +0 -5
- package/bundle/src/codex-protocol/v2/PluginShareDeleteResponse.ts +0 -5
- package/bundle/src/codex-protocol/v2/PluginShareDiscoverability.ts +0 -5
- package/bundle/src/codex-protocol/v2/PluginShareListItem.ts +0 -11
- package/bundle/src/codex-protocol/v2/PluginShareListParams.ts +0 -5
- package/bundle/src/codex-protocol/v2/PluginShareListResponse.ts +0 -6
- package/bundle/src/codex-protocol/v2/PluginSharePrincipal.ts +0 -10
- package/bundle/src/codex-protocol/v2/PluginSharePrincipalType.ts +0 -5
- package/bundle/src/codex-protocol/v2/PluginShareSaveParams.ts +0 -13
- package/bundle/src/codex-protocol/v2/PluginShareSaveResponse.ts +0 -5
- package/bundle/src/codex-protocol/v2/PluginShareTarget.ts +0 -6
- package/bundle/src/codex-protocol/v2/PluginShareUpdateDiscoverability.ts +0 -5
- package/bundle/src/codex-protocol/v2/PluginShareUpdateTargetsParams.ts +0 -11
- package/bundle/src/codex-protocol/v2/PluginShareUpdateTargetsResponse.ts +0 -10
- package/bundle/src/codex-protocol/v2/PluginSkillReadParams.ts +0 -9
- package/bundle/src/codex-protocol/v2/PluginSkillReadResponse.ts +0 -5
- package/bundle/src/codex-protocol/v2/PluginSource.ts +0 -9
- package/bundle/src/codex-protocol/v2/PluginSummary.ts +0 -29
- package/bundle/src/codex-protocol/v2/PluginUninstallParams.ts +0 -5
- package/bundle/src/codex-protocol/v2/PluginUninstallResponse.ts +0 -5
- package/bundle/src/codex-protocol/v2/PluginsMigration.ts +0 -5
- package/bundle/src/codex-protocol/v2/ProcessExitedNotification.ts +0 -43
- package/bundle/src/codex-protocol/v2/ProcessOutputDeltaNotification.ts +0 -27
- package/bundle/src/codex-protocol/v2/ProcessOutputStream.ts +0 -8
- package/bundle/src/codex-protocol/v2/ProcessTerminalSize.ts +0 -17
- package/bundle/src/codex-protocol/v2/ProfileV2.ts +0 -37
- package/bundle/src/codex-protocol/v2/RateLimitReachedType.ts +0 -10
- package/bundle/src/codex-protocol/v2/RateLimitSnapshot.ts +0 -17
- package/bundle/src/codex-protocol/v2/RateLimitWindow.ts +0 -9
- package/bundle/src/codex-protocol/v2/RawResponseItemCompletedNotification.ts +0 -10
- package/bundle/src/codex-protocol/v2/ReasoningEffortOption.ts +0 -6
- package/bundle/src/codex-protocol/v2/ReasoningSummaryPartAddedNotification.ts +0 -10
- package/bundle/src/codex-protocol/v2/ReasoningSummaryTextDeltaNotification.ts +0 -11
- package/bundle/src/codex-protocol/v2/ReasoningTextDeltaNotification.ts +0 -11
- package/bundle/src/codex-protocol/v2/RemoteControlConnectionStatus.ts +0 -5
- package/bundle/src/codex-protocol/v2/RemoteControlStatusChangedNotification.ts +0 -12
- package/bundle/src/codex-protocol/v2/RequestPermissionProfile.ts +0 -10
- package/bundle/src/codex-protocol/v2/ResidencyRequirement.ts +0 -5
- package/bundle/src/codex-protocol/v2/ReviewDelivery.ts +0 -5
- package/bundle/src/codex-protocol/v2/ReviewStartParams.ts +0 -15
- package/bundle/src/codex-protocol/v2/ReviewStartResponse.ts +0 -15
- package/bundle/src/codex-protocol/v2/ReviewTarget.ts +0 -16
- package/bundle/src/codex-protocol/v2/SandboxMode.ts +0 -5
- package/bundle/src/codex-protocol/v2/SandboxPolicy.ts +0 -17
- package/bundle/src/codex-protocol/v2/SandboxWorkspaceWrite.ts +0 -10
- package/bundle/src/codex-protocol/v2/SendAddCreditsNudgeEmailParams.ts +0 -6
- package/bundle/src/codex-protocol/v2/SendAddCreditsNudgeEmailResponse.ts +0 -6
- package/bundle/src/codex-protocol/v2/ServerRequestResolvedNotification.ts +0 -6
- package/bundle/src/codex-protocol/v2/SessionMigration.ts +0 -5
- package/bundle/src/codex-protocol/v2/SessionSource.ts +0 -13
- package/bundle/src/codex-protocol/v2/SkillDependencies.ts +0 -6
- package/bundle/src/codex-protocol/v2/SkillErrorInfo.ts +0 -5
- package/bundle/src/codex-protocol/v2/SkillInterface.ts +0 -13
- package/bundle/src/codex-protocol/v2/SkillMetadata.ts +0 -21
- package/bundle/src/codex-protocol/v2/SkillScope.ts +0 -5
- package/bundle/src/codex-protocol/v2/SkillSummary.ts +0 -14
- package/bundle/src/codex-protocol/v2/SkillToolDependency.ts +0 -12
- package/bundle/src/codex-protocol/v2/SkillsChangedNotification.ts +0 -11
- package/bundle/src/codex-protocol/v2/SkillsConfigWriteParams.ts +0 -16
- package/bundle/src/codex-protocol/v2/SkillsConfigWriteResponse.ts +0 -5
- package/bundle/src/codex-protocol/v2/SkillsListEntry.ts +0 -11
- package/bundle/src/codex-protocol/v2/SkillsListParams.ts +0 -14
- package/bundle/src/codex-protocol/v2/SkillsListResponse.ts +0 -6
- package/bundle/src/codex-protocol/v2/SortDirection.ts +0 -5
- package/bundle/src/codex-protocol/v2/SubagentMigration.ts +0 -5
- package/bundle/src/codex-protocol/v2/TerminalInteractionNotification.ts +0 -11
- package/bundle/src/codex-protocol/v2/TextElement.ts +0 -15
- package/bundle/src/codex-protocol/v2/TextPosition.ts +0 -14
- package/bundle/src/codex-protocol/v2/TextRange.ts +0 -6
- package/bundle/src/codex-protocol/v2/Thread.ts +0 -88
- package/bundle/src/codex-protocol/v2/ThreadActiveFlag.ts +0 -5
- package/bundle/src/codex-protocol/v2/ThreadApproveGuardianDeniedActionParams.ts +0 -12
- package/bundle/src/codex-protocol/v2/ThreadApproveGuardianDeniedActionResponse.ts +0 -5
- package/bundle/src/codex-protocol/v2/ThreadArchiveParams.ts +0 -5
- package/bundle/src/codex-protocol/v2/ThreadArchiveResponse.ts +0 -5
- package/bundle/src/codex-protocol/v2/ThreadArchivedNotification.ts +0 -5
- package/bundle/src/codex-protocol/v2/ThreadClosedNotification.ts +0 -5
- package/bundle/src/codex-protocol/v2/ThreadCompactStartParams.ts +0 -5
- package/bundle/src/codex-protocol/v2/ThreadCompactStartResponse.ts +0 -5
- package/bundle/src/codex-protocol/v2/ThreadForkParams.ts +0 -40
- package/bundle/src/codex-protocol/v2/ThreadForkResponse.ts +0 -30
- package/bundle/src/codex-protocol/v2/ThreadGoal.ts +0 -15
- package/bundle/src/codex-protocol/v2/ThreadGoalClearedNotification.ts +0 -5
- package/bundle/src/codex-protocol/v2/ThreadGoalStatus.ts +0 -5
- package/bundle/src/codex-protocol/v2/ThreadGoalUpdatedNotification.ts +0 -10
- package/bundle/src/codex-protocol/v2/ThreadInjectItemsParams.ts +0 -12
- package/bundle/src/codex-protocol/v2/ThreadInjectItemsResponse.ts +0 -5
- package/bundle/src/codex-protocol/v2/ThreadItem.ts +0 -156
- package/bundle/src/codex-protocol/v2/ThreadListParams.ts +0 -55
- package/bundle/src/codex-protocol/v2/ThreadListResponse.ts +0 -20
- package/bundle/src/codex-protocol/v2/ThreadLoadedListParams.ts +0 -14
- package/bundle/src/codex-protocol/v2/ThreadLoadedListResponse.ts +0 -15
- package/bundle/src/codex-protocol/v2/ThreadMetadataGitInfoUpdateParams.ts +0 -21
- package/bundle/src/codex-protocol/v2/ThreadMetadataUpdateParams.ts +0 -14
- package/bundle/src/codex-protocol/v2/ThreadMetadataUpdateResponse.ts +0 -6
- package/bundle/src/codex-protocol/v2/ThreadNameUpdatedNotification.ts +0 -5
- package/bundle/src/codex-protocol/v2/ThreadReadParams.ts +0 -11
- package/bundle/src/codex-protocol/v2/ThreadReadResponse.ts +0 -6
- package/bundle/src/codex-protocol/v2/ThreadRealtimeAudioChunk.ts +0 -14
- package/bundle/src/codex-protocol/v2/ThreadRealtimeClosedNotification.ts +0 -8
- package/bundle/src/codex-protocol/v2/ThreadRealtimeErrorNotification.ts +0 -8
- package/bundle/src/codex-protocol/v2/ThreadRealtimeItemAddedNotification.ts +0 -9
- package/bundle/src/codex-protocol/v2/ThreadRealtimeOutputAudioDeltaNotification.ts +0 -12
- package/bundle/src/codex-protocol/v2/ThreadRealtimeSdpNotification.ts +0 -8
- package/bundle/src/codex-protocol/v2/ThreadRealtimeStartTransport.ts +0 -17
- package/bundle/src/codex-protocol/v2/ThreadRealtimeStartedNotification.ts +0 -13
- package/bundle/src/codex-protocol/v2/ThreadRealtimeTranscriptDeltaNotification.ts +0 -16
- package/bundle/src/codex-protocol/v2/ThreadRealtimeTranscriptDoneNotification.ts +0 -16
- package/bundle/src/codex-protocol/v2/ThreadResumeParams.ts +0 -39
- package/bundle/src/codex-protocol/v2/ThreadResumeResponse.ts +0 -30
- package/bundle/src/codex-protocol/v2/ThreadRollbackParams.ts +0 -14
- package/bundle/src/codex-protocol/v2/ThreadRollbackResponse.ts +0 -15
- package/bundle/src/codex-protocol/v2/ThreadSetNameParams.ts +0 -5
- package/bundle/src/codex-protocol/v2/ThreadSetNameResponse.ts +0 -5
- package/bundle/src/codex-protocol/v2/ThreadShellCommandParams.ts +0 -14
- package/bundle/src/codex-protocol/v2/ThreadShellCommandResponse.ts +0 -5
- package/bundle/src/codex-protocol/v2/ThreadSortKey.ts +0 -5
- package/bundle/src/codex-protocol/v2/ThreadSource.ts +0 -5
- package/bundle/src/codex-protocol/v2/ThreadSourceKind.ts +0 -15
- package/bundle/src/codex-protocol/v2/ThreadStartParams.ts +0 -33
- package/bundle/src/codex-protocol/v2/ThreadStartResponse.ts +0 -30
- package/bundle/src/codex-protocol/v2/ThreadStartSource.ts +0 -5
- package/bundle/src/codex-protocol/v2/ThreadStartedNotification.ts +0 -6
- package/bundle/src/codex-protocol/v2/ThreadStatus.ts +0 -10
- package/bundle/src/codex-protocol/v2/ThreadStatusChangedNotification.ts +0 -6
- package/bundle/src/codex-protocol/v2/ThreadTokenUsage.ts +0 -10
- package/bundle/src/codex-protocol/v2/ThreadTokenUsageUpdatedNotification.ts +0 -10
- package/bundle/src/codex-protocol/v2/ThreadUnarchiveParams.ts +0 -5
- package/bundle/src/codex-protocol/v2/ThreadUnarchiveResponse.ts +0 -6
- package/bundle/src/codex-protocol/v2/ThreadUnarchivedNotification.ts +0 -5
- package/bundle/src/codex-protocol/v2/ThreadUnsubscribeParams.ts +0 -5
- package/bundle/src/codex-protocol/v2/ThreadUnsubscribeResponse.ts +0 -6
- package/bundle/src/codex-protocol/v2/ThreadUnsubscribeStatus.ts +0 -5
- package/bundle/src/codex-protocol/v2/TokenUsageBreakdown.ts +0 -11
- package/bundle/src/codex-protocol/v2/ToolRequestUserInputAnswer.ts +0 -8
- package/bundle/src/codex-protocol/v2/ToolRequestUserInputOption.ts +0 -8
- package/bundle/src/codex-protocol/v2/ToolRequestUserInputParams.ts +0 -14
- package/bundle/src/codex-protocol/v2/ToolRequestUserInputQuestion.ts +0 -16
- package/bundle/src/codex-protocol/v2/ToolRequestUserInputResponse.ts +0 -11
- package/bundle/src/codex-protocol/v2/ToolsV2.ts +0 -6
- package/bundle/src/codex-protocol/v2/Turn.ts +0 -36
- package/bundle/src/codex-protocol/v2/TurnCompletedNotification.ts +0 -6
- package/bundle/src/codex-protocol/v2/TurnDiffUpdatedNotification.ts +0 -9
- package/bundle/src/codex-protocol/v2/TurnEnvironmentParams.ts +0 -6
- package/bundle/src/codex-protocol/v2/TurnError.ts +0 -10
- package/bundle/src/codex-protocol/v2/TurnInterruptParams.ts +0 -5
- package/bundle/src/codex-protocol/v2/TurnInterruptResponse.ts +0 -5
- package/bundle/src/codex-protocol/v2/TurnItemsView.ts +0 -5
- package/bundle/src/codex-protocol/v2/TurnPlanStep.ts +0 -6
- package/bundle/src/codex-protocol/v2/TurnPlanStepStatus.ts +0 -5
- package/bundle/src/codex-protocol/v2/TurnPlanUpdatedNotification.ts +0 -11
- package/bundle/src/codex-protocol/v2/TurnStartParams.ts +0 -48
- package/bundle/src/codex-protocol/v2/TurnStartResponse.ts +0 -6
- package/bundle/src/codex-protocol/v2/TurnStartedNotification.ts +0 -6
- package/bundle/src/codex-protocol/v2/TurnStatus.ts +0 -5
- package/bundle/src/codex-protocol/v2/TurnSteerParams.ts +0 -13
- package/bundle/src/codex-protocol/v2/TurnSteerResponse.ts +0 -5
- package/bundle/src/codex-protocol/v2/UserInput.ts +0 -18
- package/bundle/src/codex-protocol/v2/WarningNotification.ts +0 -14
- package/bundle/src/codex-protocol/v2/WebSearchAction.ts +0 -9
- package/bundle/src/codex-protocol/v2/WindowsSandboxReadiness.ts +0 -5
- package/bundle/src/codex-protocol/v2/WindowsSandboxReadinessResponse.ts +0 -6
- package/bundle/src/codex-protocol/v2/WindowsSandboxSetupCompletedNotification.ts +0 -10
- package/bundle/src/codex-protocol/v2/WindowsSandboxSetupMode.ts +0 -5
- package/bundle/src/codex-protocol/v2/WindowsSandboxSetupStartParams.ts +0 -10
- package/bundle/src/codex-protocol/v2/WindowsSandboxSetupStartResponse.ts +0 -5
- package/bundle/src/codex-protocol/v2/WindowsWorldWritableWarningNotification.ts +0 -9
- package/bundle/src/codex-protocol/v2/WriteStatus.ts +0 -5
- package/bundle/src/codex-protocol/v2/index.ts +0 -446
- package/bundle/src/utils/providers/openai/codex-rpc.ts +0 -238
- package/bundle/src/utils/providers/openai/codex-worker.test.ts +0 -1006
- package/bundle/src/utils/providers/openai/codex-worker.ts +0 -927
- package/bundle/src/utils/providers/openai/openai-worker-pool-config.ts +0 -112
- package/bundle/web-dist/client/assets/index-C0594sjh.js +0 -106
- package/bundle/web-dist/client/assets/index-CcMEpCgt.css +0 -1
- package/bundle/web-dist/client/assets/logs-BotUcOEB.js +0 -1
- package/bundle/web-dist/client/assets/monit-kk3vnGvu.js +0 -1
- package/bundle/web-dist/client/assets/settings-CAAQSIyg.js +0 -1
- package/bundle/web-dist/client/assets/show-BryNvjUT.js +0 -2
- /package/bundle/dist/{codex-protocol/AbsolutePathBuf.js → utils/providers/common/provider-types.js} +0 -0
|
@@ -1,1775 +1,388 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { describe, expect, it, vi } from "vitest";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { TokenModel } from "../../../application/token/token.model";
|
|
5
|
-
import { type OpenAICredentials } from "../../../application/token/token.types";
|
|
6
|
-
import { type GenerateRequest, type GenerateResult } from "../common/provider-dispatcher";
|
|
7
|
-
import { CodexAppServerWorker } from "./codex-worker";
|
|
3
|
+
import { type GenerateRequest } from "../common/provider-dispatcher";
|
|
8
4
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} from "./openai-dispatcher";
|
|
13
|
-
import { type
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
loggerWarnMock: vi.fn(),
|
|
25
|
-
}));
|
|
26
|
-
|
|
27
|
-
vi.mock("@logtape/logtape", () => ({
|
|
28
|
-
getLogger: () => ({ info: loggerInfoMock, warn: loggerWarnMock }),
|
|
29
|
-
}));
|
|
30
|
-
|
|
31
|
-
vi.mock("./openai-quota", () => ({
|
|
32
|
-
readOpenAIQuotaUsage: readOpenAIQuotaUsageMock,
|
|
33
|
-
}));
|
|
34
|
-
|
|
35
|
-
function credentials(overrides: Partial<OpenAICredentials> = {}): OpenAICredentials {
|
|
36
|
-
return {
|
|
37
|
-
accessToken: "access",
|
|
38
|
-
refreshToken: "refresh",
|
|
39
|
-
accessTokenExpiresAt: Date.now() + 60_000,
|
|
40
|
-
accountId: "account",
|
|
41
|
-
planType: "plus",
|
|
42
|
-
...overrides,
|
|
43
|
-
};
|
|
5
|
+
type OpenAINormalizedEvent,
|
|
6
|
+
type OpenAIResponsesOptions,
|
|
7
|
+
} from "./openai-backend-protocol";
|
|
8
|
+
import { ImageGenerationError, OpenAIDispatcher } from "./openai-dispatcher";
|
|
9
|
+
import { type OpenAITransportKind } from "./openai-transport-config";
|
|
10
|
+
|
|
11
|
+
const credentials = {
|
|
12
|
+
accessToken: "access",
|
|
13
|
+
refreshToken: "refresh",
|
|
14
|
+
accessTokenExpiresAt: 1,
|
|
15
|
+
accountId: "acct",
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
function config(): OpenAITransportKind {
|
|
19
|
+
return "https";
|
|
44
20
|
}
|
|
45
21
|
|
|
46
|
-
function
|
|
22
|
+
function request(overrides: Partial<GenerateRequest> = {}): GenerateRequest {
|
|
47
23
|
return {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
windowDurationMins: 300,
|
|
52
|
-
resetsAt: 1_782_912_345,
|
|
53
|
-
limitId: "codex-primary",
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function quotaFail(reason = "rate limit lookup failed"): OpenAIQuotaUsageResult {
|
|
58
|
-
return { kind: "lookup_failed", reason };
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function deferred<T>(): { promise: Promise<T>; resolve: (value: T) => void } {
|
|
62
|
-
let resolve!: (value: T) => void;
|
|
63
|
-
const promise = new Promise<T>((done) => {
|
|
64
|
-
resolve = done;
|
|
65
|
-
});
|
|
66
|
-
return { promise, resolve };
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function baseReq(overrides: Partial<GenerateRequest> = {}): GenerateRequest {
|
|
70
|
-
return {
|
|
71
|
-
model: "gpt-5-codex",
|
|
72
|
-
systemPrompt: "you are helpful",
|
|
73
|
-
coldInput: [{ type: "text", text: "hi", text_elements: [] }],
|
|
24
|
+
model: "gpt-test",
|
|
25
|
+
coldHistory: [{ type: "message", role: "assistant", content: "old" }],
|
|
26
|
+
coldInput: [{ type: "text", text: "new", text_elements: [] }],
|
|
74
27
|
...overrides,
|
|
75
28
|
};
|
|
76
29
|
}
|
|
77
30
|
|
|
78
|
-
function
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
cachedInputTokens: 0,
|
|
86
|
-
outputTokens: 0,
|
|
87
|
-
reasoningOutputTokens: 0,
|
|
88
|
-
},
|
|
89
|
-
durationMs: 10,
|
|
90
|
-
model: "gpt-5-codex",
|
|
91
|
-
threadCoord: {
|
|
92
|
-
workerId: makeOpenAIWorkerId(worker.tokenId, worker.workerIndex),
|
|
93
|
-
threadId,
|
|
94
|
-
epoch: worker.epoch,
|
|
95
|
-
},
|
|
96
|
-
};
|
|
31
|
+
function dispatcher(
|
|
32
|
+
run: (
|
|
33
|
+
options: OpenAIResponsesOptions,
|
|
34
|
+
signal?: AbortSignal,
|
|
35
|
+
) => AsyncIterable<OpenAINormalizedEvent>,
|
|
36
|
+
) {
|
|
37
|
+
return new OpenAIDispatcher(config(), { clientFactory: () => ({ responses: run }) });
|
|
97
38
|
}
|
|
98
39
|
|
|
99
|
-
function
|
|
100
|
-
|
|
101
|
-
| boolean
|
|
102
|
-
| {
|
|
103
|
-
tokenId?: number;
|
|
104
|
-
tokenName?: string;
|
|
105
|
-
workerIndex?: number;
|
|
106
|
-
reusable?: boolean;
|
|
107
|
-
ready?: boolean;
|
|
108
|
-
active?: boolean;
|
|
109
|
-
busy?: boolean;
|
|
110
|
-
threads?: string[];
|
|
111
|
-
epoch?: number;
|
|
112
|
-
rateLimits?: unknown;
|
|
113
|
-
// 이미지 게이트/생성 mock. imageGateReason 이 있으면 checkImageGenerationSupport 가
|
|
114
|
-
// 그 사유를 반환(불가), null 이면 통과. imageTurnResult 로 worker.executeTurn 반환값 지정.
|
|
115
|
-
imageGateReason?: string | null;
|
|
116
|
-
imageTurnResult?: { images?: Array<{ data: string; revisedPrompt: string | null }>; imageAttempted?: boolean };
|
|
117
|
-
},
|
|
118
|
-
): CodexAppServerWorker {
|
|
119
|
-
const options =
|
|
120
|
-
typeof reusableOrOptions === "boolean" ? { reusable: reusableOrOptions } : reusableOrOptions;
|
|
121
|
-
let busy = options.busy ?? false;
|
|
122
|
-
const worker = {
|
|
123
|
-
tokenId: options.tokenId ?? 1,
|
|
124
|
-
tokenName: options.tokenName ?? "token",
|
|
125
|
-
workerIndex: options.workerIndex ?? 0,
|
|
126
|
-
active: options.active ?? true,
|
|
127
|
-
epoch: options.epoch ?? 1,
|
|
128
|
-
kill: vi.fn(async () => {}),
|
|
129
|
-
canReuseForToken: vi.fn(() => options.reusable ?? true),
|
|
130
|
-
updateTokenState: vi.fn(),
|
|
131
|
-
get isReady() {
|
|
132
|
-
return options.ready ?? true;
|
|
133
|
-
},
|
|
134
|
-
get hasCapacity() {
|
|
135
|
-
return !busy;
|
|
136
|
-
},
|
|
137
|
-
tryAcquireTurn: vi.fn(() => {
|
|
138
|
-
if (busy) return false;
|
|
139
|
-
busy = true;
|
|
140
|
-
return true;
|
|
141
|
-
}),
|
|
142
|
-
releaseTurn: vi.fn(() => {
|
|
143
|
-
busy = false;
|
|
144
|
-
}),
|
|
145
|
-
sweepIdleThreads: vi.fn(),
|
|
146
|
-
hasThread: vi.fn((threadId: string) => (options.threads ?? []).includes(threadId)),
|
|
147
|
-
getRateLimits: vi.fn(
|
|
148
|
-
async () => options.rateLimits ?? { rateLimits: {}, rateLimitsByLimitId: null },
|
|
149
|
-
),
|
|
150
|
-
checkImageGenerationSupport: vi.fn(async () => options.imageGateReason ?? null),
|
|
151
|
-
executeTurn: vi.fn(async () => ({
|
|
152
|
-
text: "ok",
|
|
153
|
-
usage: { totalTokens: 1, inputTokens: 1, cachedInputTokens: 0, outputTokens: 0, reasoningOutputTokens: 0 },
|
|
154
|
-
durationMs: 10,
|
|
155
|
-
ttftMs: null,
|
|
156
|
-
model: "gpt-5-codex",
|
|
157
|
-
threadId: "thread-new",
|
|
158
|
-
images: options.imageTurnResult?.images,
|
|
159
|
-
imageAttempted: options.imageTurnResult?.imageAttempted,
|
|
160
|
-
})),
|
|
161
|
-
} as unknown as CodexAppServerWorker;
|
|
162
|
-
return worker;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
beforeEach(() => {
|
|
166
|
-
readOpenAIQuotaUsageMock.mockReset();
|
|
167
|
-
readOpenAIQuotaUsageMock.mockResolvedValue(quotaOk(0));
|
|
168
|
-
loggerInfoMock.mockReset();
|
|
169
|
-
loggerWarnMock.mockReset();
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
function addWorkers(dispatcher: OpenAIDispatcher, workers: CodexAppServerWorker[]): void {
|
|
173
|
-
const byToken = new Map<number, CodexAppServerWorker[]>();
|
|
174
|
-
for (const worker of workers) {
|
|
175
|
-
const group = byToken.get(worker.tokenId) ?? [];
|
|
176
|
-
group.push(worker);
|
|
177
|
-
byToken.set(worker.tokenId, group);
|
|
178
|
-
}
|
|
179
|
-
for (const [tokenId, group] of byToken) dispatcher.workerPool.set(tokenId, group);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
function autoscaleConfig(
|
|
183
|
-
overrides: Partial<OpenAIWorkerPoolConfig> = {},
|
|
184
|
-
): OpenAIWorkerPoolConfig {
|
|
185
|
-
return {
|
|
186
|
-
autoscale: true,
|
|
187
|
-
minWorkersPerToken: 1,
|
|
188
|
-
maxWorkersPerToken: 3,
|
|
189
|
-
scaleIntervalMs: 5_000,
|
|
190
|
-
scaleDownIdleMs: 600_000,
|
|
191
|
-
maxEstimatedRssGiB: 16,
|
|
192
|
-
minHostAvailableGiB: 20,
|
|
193
|
-
...overrides,
|
|
194
|
-
};
|
|
40
|
+
async function* events(...values: OpenAINormalizedEvent[]) {
|
|
41
|
+
yield* values;
|
|
195
42
|
}
|
|
196
43
|
|
|
197
|
-
async function
|
|
198
|
-
|
|
199
|
-
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
200
|
-
if (dispatcher.queueLength === length) return;
|
|
201
|
-
}
|
|
202
|
-
expect(dispatcher.queueLength).toBe(length);
|
|
44
|
+
async function tickTimer(): Promise<void> {
|
|
45
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
203
46
|
}
|
|
204
47
|
|
|
205
|
-
describe("OpenAIDispatcher
|
|
206
|
-
it("
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
const workerIds = tokenIds.flatMap((tokenId) =>
|
|
211
|
-
Array.from({ length: MAX_OPENAI_WORKERS_PER_TOKEN }, (_, workerIndex) =>
|
|
212
|
-
makeOpenAIWorkerId(tokenId, workerIndex),
|
|
213
|
-
),
|
|
214
|
-
);
|
|
215
|
-
|
|
216
|
-
expect(new Set(workerIds)).toHaveLength(workerIds.length);
|
|
217
|
-
expect(makeOpenAIWorkerId(1, 10)).not.toBe(makeOpenAIWorkerId(2, 0));
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
it("defaults to autoscaling from 1 to 3 workers per token", () => {
|
|
221
|
-
// dev0 OOM 사고(SON-516) 응급처치로 기본값을 5-15 에서 1-3 으로 축소 (f6d1333).
|
|
222
|
-
expect(resolveOpenAIWorkerPoolConfig({})).toMatchObject({
|
|
223
|
-
autoscale: true,
|
|
224
|
-
minWorkersPerToken: 1,
|
|
225
|
-
maxWorkersPerToken: 3,
|
|
226
|
-
});
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
it("keeps an explicit fixed worker mode for emergency rollback", () => {
|
|
230
|
-
expect(
|
|
231
|
-
resolveOpenAIWorkerPoolConfig({
|
|
232
|
-
QGRID_OPENAI_MIN_WORKERS_PER_TOKEN: "5",
|
|
233
|
-
QGRID_OPENAI_AUTOSCALE: "false",
|
|
234
|
-
}),
|
|
235
|
-
).toMatchObject({
|
|
236
|
-
autoscale: false,
|
|
237
|
-
minWorkersPerToken: 5,
|
|
238
|
-
maxWorkersPerToken: 5,
|
|
239
|
-
});
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
it("ignores the removed QGRID_WORKERS_PER_TOKEN variable", () => {
|
|
243
|
-
// 과거엔 min 의 폴백이었다 — dev0 사고 조사(SON-516)에서 이름과 달리 min 에만
|
|
244
|
-
// 꽂히는 함정으로 확인되어 제거. QGRID_OPENAI_MIN_WORKERS_PER_TOKEN 하나로 통일.
|
|
245
|
-
expect(
|
|
246
|
-
resolveOpenAIWorkerPoolConfig({ QGRID_WORKERS_PER_TOKEN: "15" }),
|
|
247
|
-
).toMatchObject({ minWorkersPerToken: 1, maxWorkersPerToken: 3 });
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
it("estimates worker RSS from the dev0 measurement model", () => {
|
|
251
|
-
expect(estimateOpenAIWorkerRssGiB(50)).toBeCloseTo(8.56, 2);
|
|
252
|
-
expect(estimateOpenAIWorkerRssGiB(60)).toBeCloseTo(10.13, 2);
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
it("clamps memory guard inputs to the 64 GiB host policy", () => {
|
|
256
|
-
expect(
|
|
257
|
-
resolveOpenAIWorkerPoolConfig({
|
|
258
|
-
QGRID_OPENAI_MAX_ESTIMATED_RSS_GIB: "999",
|
|
259
|
-
QGRID_OPENAI_MIN_HOST_AVAILABLE_GIB: "999",
|
|
260
|
-
}),
|
|
261
|
-
).toMatchObject({
|
|
262
|
-
maxEstimatedRssGiB: 32,
|
|
263
|
-
minHostAvailableGiB: 64,
|
|
264
|
-
});
|
|
265
|
-
});
|
|
266
|
-
});
|
|
267
|
-
|
|
268
|
-
describe("OpenAIDispatcher monit stats", () => {
|
|
269
|
-
it("reports worker counts grouped by token name", () => {
|
|
270
|
-
const dispatcher = new OpenAIDispatcher(autoscaleConfig({ autoscale: false }), () => 64);
|
|
271
|
-
addWorkers(dispatcher, [
|
|
272
|
-
fakeWorker({ tokenId: 1, tokenName: "openai/nk" }),
|
|
273
|
-
fakeWorker({ tokenId: 1, tokenName: "openai/nk", workerIndex: 1 }),
|
|
274
|
-
fakeWorker({ tokenId: 2, tokenName: "openai/haze" }),
|
|
275
|
-
]);
|
|
276
|
-
|
|
277
|
-
expect(dispatcher.workerCountsByToken).toEqual([
|
|
278
|
-
{ name: "openai/haze", count: 1 },
|
|
279
|
-
{ name: "openai/nk", count: 2 },
|
|
280
|
-
]);
|
|
281
|
-
});
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
describe("OpenAIDispatcher autoscaling", () => {
|
|
285
|
-
it("runs minimum-capacity maintenance in fixed worker mode", async () => {
|
|
286
|
-
vi.useFakeTimers();
|
|
287
|
-
const findMany = vi.spyOn(TokenModel, "findMany").mockResolvedValue({ rows: [] } as never);
|
|
288
|
-
const dispatcher = new OpenAIDispatcher(
|
|
289
|
-
autoscaleConfig({
|
|
290
|
-
autoscale: false,
|
|
291
|
-
minWorkersPerToken: 2,
|
|
292
|
-
maxWorkersPerToken: 2,
|
|
293
|
-
}),
|
|
294
|
-
() => 64,
|
|
295
|
-
);
|
|
296
|
-
const evaluateAutoscaling = vi
|
|
297
|
-
.spyOn(dispatcher, "evaluateAutoscaling")
|
|
298
|
-
.mockResolvedValue(undefined);
|
|
299
|
-
|
|
300
|
-
try {
|
|
301
|
-
await dispatcher.start();
|
|
302
|
-
await vi.advanceTimersByTimeAsync(5_000);
|
|
303
|
-
|
|
304
|
-
expect(evaluateAutoscaling).toHaveBeenCalledTimes(1);
|
|
305
|
-
} finally {
|
|
306
|
-
await dispatcher.stop();
|
|
307
|
-
findMany.mockRestore();
|
|
308
|
-
vi.useRealTimers();
|
|
309
|
-
}
|
|
310
|
-
});
|
|
311
|
-
|
|
312
|
-
it("runs idle-thread cleanup from the fixed-mode health timer", async () => {
|
|
313
|
-
vi.useFakeTimers();
|
|
314
|
-
const findMany = vi.spyOn(TokenModel, "findMany").mockResolvedValue({ rows: [] } as never);
|
|
315
|
-
const dispatcher = new OpenAIDispatcher(
|
|
316
|
-
autoscaleConfig({
|
|
317
|
-
autoscale: false,
|
|
318
|
-
minWorkersPerToken: 1,
|
|
319
|
-
maxWorkersPerToken: 1,
|
|
320
|
-
}),
|
|
321
|
-
() => 64,
|
|
322
|
-
);
|
|
323
|
-
const worker = fakeWorker({ tokenId: 1 });
|
|
324
|
-
addWorkers(dispatcher, [worker]);
|
|
325
|
-
|
|
326
|
-
try {
|
|
327
|
-
await dispatcher.start();
|
|
328
|
-
await vi.advanceTimersByTimeAsync(5_000);
|
|
329
|
-
|
|
330
|
-
expect(worker.sweepIdleThreads).toHaveBeenCalledTimes(1);
|
|
331
|
-
} finally {
|
|
332
|
-
await dispatcher.stop();
|
|
333
|
-
findMany.mockRestore();
|
|
334
|
-
vi.useRealTimers();
|
|
335
|
-
}
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
it("sweeps only ready idle workers so active turns keep their subscription", async () => {
|
|
339
|
-
const dispatcher = new OpenAIDispatcher(autoscaleConfig(), () => 64);
|
|
340
|
-
const idle = fakeWorker({ tokenId: 1, workerIndex: 0 });
|
|
341
|
-
const busy = fakeWorker({ tokenId: 1, workerIndex: 1, busy: true });
|
|
342
|
-
const restarting = fakeWorker({ tokenId: 1, workerIndex: 2, ready: false });
|
|
343
|
-
addWorkers(dispatcher, [idle, busy, restarting]);
|
|
344
|
-
|
|
345
|
-
await dispatcher.evaluateAutoscaling();
|
|
346
|
-
|
|
347
|
-
expect(idle.sweepIdleThreads).toHaveBeenCalledTimes(1);
|
|
348
|
-
expect(busy.sweepIdleThreads).not.toHaveBeenCalled();
|
|
349
|
-
expect(restarting.sweepIdleThreads).not.toHaveBeenCalled();
|
|
350
|
-
});
|
|
351
|
-
|
|
352
|
-
it("repairs an absent token pool after every initial worker spawn failed", async () => {
|
|
353
|
-
const dispatcher = new OpenAIDispatcher(autoscaleConfig(), () => 64);
|
|
354
|
-
const tokenCredentials = credentials();
|
|
355
|
-
const spawnSingleWorker = vi.spyOn(dispatcher, "spawnSingleWorker").mockResolvedValueOnce(null);
|
|
356
|
-
|
|
357
|
-
await dispatcher.spawnWorkers(1, "token", tokenCredentials, null, 1);
|
|
358
|
-
expect(dispatcher.workerPool.has(1)).toBe(false);
|
|
359
|
-
|
|
360
|
-
const recoveredWorker = fakeWorker({ tokenId: 1, workerIndex: 0 });
|
|
361
|
-
spawnSingleWorker.mockResolvedValueOnce(recoveredWorker);
|
|
362
|
-
await dispatcher.evaluateAutoscaling();
|
|
363
|
-
|
|
364
|
-
expect(dispatcher.workerPool.get(1)).toEqual([recoveredWorker]);
|
|
365
|
-
expect(recoveredWorker.kill).not.toHaveBeenCalled();
|
|
366
|
-
});
|
|
367
|
-
|
|
368
|
-
it("does not race minimum repair against an in-flight token bootstrap", async () => {
|
|
369
|
-
const dispatcher = new OpenAIDispatcher(autoscaleConfig(), () => 64);
|
|
370
|
-
const pendingSpawn = deferred<CodexAppServerWorker | null>();
|
|
371
|
-
const spawnSingleWorker = vi
|
|
372
|
-
.spyOn(dispatcher, "spawnSingleWorker")
|
|
373
|
-
.mockReturnValue(pendingSpawn.promise);
|
|
374
|
-
|
|
375
|
-
const bootstrap = dispatcher.spawnWorkers(1, "token", credentials(), null, 1);
|
|
376
|
-
await vi.waitFor(() => expect(spawnSingleWorker).toHaveBeenCalledTimes(1));
|
|
377
|
-
const evaluation = dispatcher.evaluateAutoscaling();
|
|
378
|
-
|
|
379
|
-
expect(spawnSingleWorker).toHaveBeenCalledTimes(1);
|
|
380
|
-
const worker = fakeWorker({ tokenId: 1, workerIndex: 0 });
|
|
381
|
-
pendingSpawn.resolve(worker);
|
|
382
|
-
await Promise.all([bootstrap, evaluation]);
|
|
383
|
-
|
|
384
|
-
expect(dispatcher.workerPool.get(1)).toEqual([worker]);
|
|
385
|
-
expect(worker.kill).not.toHaveBeenCalled();
|
|
386
|
-
});
|
|
387
|
-
|
|
388
|
-
it("discards a bootstrapping worker when its token is removed mid-spawn", async () => {
|
|
389
|
-
const dispatcher = new OpenAIDispatcher(autoscaleConfig(), () => 64);
|
|
390
|
-
const pendingSpawn = deferred<CodexAppServerWorker | null>();
|
|
391
|
-
const spawnSingleWorker = vi
|
|
392
|
-
.spyOn(dispatcher, "spawnSingleWorker")
|
|
393
|
-
.mockReturnValue(pendingSpawn.promise);
|
|
394
|
-
|
|
395
|
-
const bootstrap = dispatcher.spawnWorkers(1, "token", credentials(), null, 1);
|
|
396
|
-
await vi.waitFor(() => expect(spawnSingleWorker).toHaveBeenCalledTimes(1));
|
|
397
|
-
await dispatcher.onTokenRemoved(1);
|
|
398
|
-
const staleWorker = fakeWorker({ tokenId: 1, workerIndex: 0 });
|
|
399
|
-
pendingSpawn.resolve(staleWorker);
|
|
400
|
-
await bootstrap;
|
|
401
|
-
|
|
402
|
-
expect(dispatcher.workerPool.has(1)).toBe(false);
|
|
403
|
-
expect(staleWorker.kill).toHaveBeenCalledTimes(1);
|
|
404
|
-
});
|
|
405
|
-
|
|
406
|
-
it("repairs the configured minimum even when demand autoscaling is disabled", async () => {
|
|
407
|
-
const dispatcher = new OpenAIDispatcher(
|
|
408
|
-
autoscaleConfig({
|
|
409
|
-
autoscale: false,
|
|
410
|
-
minWorkersPerToken: 2,
|
|
411
|
-
maxWorkersPerToken: 2,
|
|
48
|
+
describe("OpenAIDispatcher direct runtime", () => {
|
|
49
|
+
it("passes the resolved transport to the injectable client factory", async () => {
|
|
50
|
+
const factory = vi.fn(
|
|
51
|
+
(_options: import("./openai-direct-client").OpenAIDirectClientOptions) => ({
|
|
52
|
+
responses: () => events({ type: "completed", responseId: "r" }),
|
|
412
53
|
}),
|
|
413
|
-
() => 0,
|
|
414
54
|
);
|
|
415
|
-
const
|
|
416
|
-
|
|
417
|
-
await
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
expect(spawnSingleWorker).toHaveBeenCalledTimes(1);
|
|
443
|
-
dispatcher.queue = [];
|
|
444
|
-
});
|
|
445
|
-
|
|
446
|
-
it("keeps scaling healthy tokens when another token minimum repair fails", async () => {
|
|
447
|
-
const dispatcher = new OpenAIDispatcher(autoscaleConfig(), () => 64);
|
|
448
|
-
vi.spyOn(dispatcher, "spawnWorkers").mockResolvedValue(undefined);
|
|
449
|
-
await dispatcher.onTokenAdded(1, "broken", credentials(), null, 1);
|
|
450
|
-
await dispatcher.onTokenAdded(2, "healthy", credentials(), null, 1);
|
|
451
|
-
dispatcher.workerPool.set(2, [
|
|
452
|
-
fakeWorker({ tokenId: 2, tokenName: "healthy", workerIndex: 0, busy: true }),
|
|
453
|
-
]);
|
|
454
|
-
dispatcher.queue.push({} as never);
|
|
455
|
-
const healthyExpansion = fakeWorker({
|
|
456
|
-
tokenId: 2,
|
|
457
|
-
tokenName: "healthy",
|
|
458
|
-
workerIndex: 1,
|
|
55
|
+
const d = new OpenAIDispatcher("websocket", { clientFactory: factory });
|
|
56
|
+
await d.onTokenAdded(1, "one", credentials);
|
|
57
|
+
await d.generate(request());
|
|
58
|
+
await d.generate(request());
|
|
59
|
+
expect(factory.mock.calls[0]?.[0]).toMatchObject({ transportKind: "websocket" });
|
|
60
|
+
expect(factory).toHaveBeenCalledTimes(1);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("maps complete cold context and Responses controls, then maps usage and affinity", async () => {
|
|
64
|
+
let mapped: OpenAIResponsesOptions | undefined;
|
|
65
|
+
const d = dispatcher((options) => {
|
|
66
|
+
mapped = options;
|
|
67
|
+
return events(
|
|
68
|
+
{ type: "text-delta", text: "hello" },
|
|
69
|
+
{
|
|
70
|
+
type: "completed",
|
|
71
|
+
responseId: "r1",
|
|
72
|
+
usage: {
|
|
73
|
+
inputTokens: 8,
|
|
74
|
+
cachedInputTokens: 3,
|
|
75
|
+
outputTokens: 2,
|
|
76
|
+
reasoningTokens: 1,
|
|
77
|
+
totalTokens: 10,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
);
|
|
459
81
|
});
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
it("does not duplicate a minimum slot while its worker is transiently restarting", async () => {
|
|
472
|
-
const dispatcher = new OpenAIDispatcher(autoscaleConfig(), () => 64);
|
|
473
|
-
vi.spyOn(dispatcher, "spawnWorkers").mockResolvedValue(undefined);
|
|
474
|
-
await dispatcher.onTokenAdded(1, "token", credentials(), null, 1);
|
|
475
|
-
dispatcher.workerPool.set(1, [
|
|
476
|
-
fakeWorker({ tokenId: 1, workerIndex: 0, ready: false }),
|
|
477
|
-
]);
|
|
478
|
-
const spawnSingleWorker = vi.spyOn(dispatcher, "spawnSingleWorker");
|
|
479
|
-
|
|
480
|
-
await dispatcher.evaluateAutoscaling();
|
|
481
|
-
|
|
482
|
-
expect(spawnSingleWorker).not.toHaveBeenCalled();
|
|
483
|
-
expect(dispatcher.workerPool.get(1)).toHaveLength(1);
|
|
484
|
-
});
|
|
485
|
-
|
|
486
|
-
it("queues while active token metadata exists but every worker is unavailable", async () => {
|
|
487
|
-
const dispatcher = new OpenAIDispatcher(autoscaleConfig(), () => 64);
|
|
488
|
-
vi.spyOn(dispatcher, "spawnWorkers").mockResolvedValue(undefined);
|
|
489
|
-
await dispatcher.onTokenAdded(1, "token", credentials(), null, 1);
|
|
490
|
-
const evaluateAutoscaling = vi
|
|
491
|
-
.spyOn(dispatcher, "evaluateAutoscaling")
|
|
492
|
-
.mockResolvedValue(undefined);
|
|
493
|
-
|
|
494
|
-
const queued = dispatcher.enqueue(async (worker) => worker.tokenName);
|
|
495
|
-
await waitForQueue(dispatcher);
|
|
496
|
-
|
|
497
|
-
expect(evaluateAutoscaling).toHaveBeenCalled();
|
|
498
|
-
const recovered = fakeWorker({ tokenId: 1, workerIndex: 0 });
|
|
499
|
-
dispatcher.workerPool.set(1, [recovered]);
|
|
500
|
-
await dispatcher.drainQueue();
|
|
501
|
-
|
|
502
|
-
await expect(queued).resolves.toBe("token");
|
|
503
|
-
});
|
|
504
|
-
|
|
505
|
-
it("still rejects immediately when no active OpenAI token metadata exists", async () => {
|
|
506
|
-
const dispatcher = new OpenAIDispatcher(autoscaleConfig(), () => 64);
|
|
507
|
-
|
|
508
|
-
await expect(dispatcher.enqueue(async () => "ok")).rejects.toThrow("NO_OPENAI_WORKERS");
|
|
509
|
-
expect(dispatcher.queueLength).toBe(0);
|
|
510
|
-
});
|
|
511
|
-
|
|
512
|
-
it("keeps a recovery queue when another token is removed but an active token remains", async () => {
|
|
513
|
-
const dispatcher = new OpenAIDispatcher(autoscaleConfig(), () => 64);
|
|
514
|
-
vi.spyOn(dispatcher, "spawnWorkers").mockResolvedValue(undefined);
|
|
515
|
-
await dispatcher.onTokenAdded(1, "removed", credentials(), null, 1);
|
|
516
|
-
await dispatcher.onTokenAdded(2, "recovering", credentials(), null, 1);
|
|
517
|
-
|
|
518
|
-
const queued = dispatcher.enqueue(async () => "ok");
|
|
519
|
-
const rejection = expect(queued).rejects.toThrow("TEST_CLEANUP");
|
|
520
|
-
await waitForQueue(dispatcher);
|
|
521
|
-
await dispatcher.onTokenRemoved(1);
|
|
522
|
-
|
|
523
|
-
expect(dispatcher.queueLength).toBe(1);
|
|
524
|
-
dispatcher.rejectAllQueued("TEST_CLEANUP");
|
|
525
|
-
await rejection;
|
|
526
|
-
});
|
|
527
|
-
|
|
528
|
-
it("keeps a recovery queue when another token is deactivated but an active token remains", async () => {
|
|
529
|
-
const dispatcher = new OpenAIDispatcher(autoscaleConfig(), () => 64);
|
|
530
|
-
vi.spyOn(dispatcher, "spawnWorkers").mockResolvedValue(undefined);
|
|
531
|
-
await dispatcher.onTokenAdded(1, "deactivated", credentials(), null, 1);
|
|
532
|
-
await dispatcher.onTokenAdded(2, "recovering", credentials(), null, 1);
|
|
533
|
-
|
|
534
|
-
const queued = dispatcher.enqueue(async () => "ok");
|
|
535
|
-
const rejection = expect(queued).rejects.toThrow("TEST_CLEANUP");
|
|
536
|
-
await waitForQueue(dispatcher);
|
|
537
|
-
dispatcher.onTokenDeactivated(1);
|
|
538
|
-
|
|
539
|
-
expect(dispatcher.queueLength).toBe(1);
|
|
540
|
-
dispatcher.rejectAllQueued("TEST_CLEANUP");
|
|
541
|
-
await rejection;
|
|
542
|
-
});
|
|
543
|
-
|
|
544
|
-
it("drains immediately when capacity appears before a fixed-mode queue wake-up", async () => {
|
|
545
|
-
const dispatcher = new OpenAIDispatcher(
|
|
546
|
-
autoscaleConfig({
|
|
547
|
-
autoscale: false,
|
|
548
|
-
minWorkersPerToken: 1,
|
|
549
|
-
maxWorkersPerToken: 1,
|
|
82
|
+
await d.onTokenAdded(7, "primary", credentials, null, 1);
|
|
83
|
+
|
|
84
|
+
const result = await d.generate(
|
|
85
|
+
request({
|
|
86
|
+
systemPrompt: "system",
|
|
87
|
+
effort: "high",
|
|
88
|
+
reasoningSummary: "none",
|
|
89
|
+
verbosity: "low",
|
|
90
|
+
serviceTier: "fast",
|
|
91
|
+
promptCacheKey: "cache-key",
|
|
92
|
+
outputSchema: { type: "object", additionalProperties: false },
|
|
550
93
|
}),
|
|
551
|
-
() => 64,
|
|
552
94
|
);
|
|
553
|
-
const worker = fakeWorker({ tokenId: 1, workerIndex: 0 });
|
|
554
|
-
addWorkers(dispatcher, [worker]);
|
|
555
|
-
await dispatcher.onTokenUpdated(1, "token", credentials(), null, 1);
|
|
556
|
-
|
|
557
|
-
await expect(dispatcher.enqueue(async (selected) => selected.tokenName)).resolves.toBe(
|
|
558
|
-
"token",
|
|
559
|
-
);
|
|
560
|
-
expect(dispatcher.queueLength).toBe(0);
|
|
561
|
-
});
|
|
562
|
-
|
|
563
|
-
it("scales six active tokens from 5 to 15 workers per token", async () => {
|
|
564
|
-
const dispatcher = new OpenAIDispatcher(
|
|
565
|
-
autoscaleConfig({
|
|
566
|
-
minWorkersPerToken: 5,
|
|
567
|
-
maxWorkersPerToken: 15,
|
|
568
|
-
maxEstimatedRssGiB: 16,
|
|
569
|
-
}),
|
|
570
|
-
() => 64,
|
|
571
|
-
);
|
|
572
|
-
vi.spyOn(dispatcher, "spawnWorkers").mockResolvedValue(undefined);
|
|
573
|
-
|
|
574
|
-
for (let tokenId = 1; tokenId <= 6; tokenId++) {
|
|
575
|
-
await dispatcher.onTokenAdded(tokenId, `token-${tokenId}`, credentials(), null, 1);
|
|
576
|
-
dispatcher.workerPool.set(
|
|
577
|
-
tokenId,
|
|
578
|
-
Array.from({ length: 5 }, (_, workerIndex) => fakeWorker({ tokenId, workerIndex })),
|
|
579
|
-
);
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
vi.spyOn(dispatcher, "spawnSingleWorker").mockImplementation(
|
|
583
|
-
async (tokenId, tokenName, _credentials, workerIndex) =>
|
|
584
|
-
fakeWorker({ tokenId, tokenName, workerIndex }),
|
|
585
|
-
);
|
|
586
|
-
|
|
587
|
-
for (let step = 0; step < 12; step++) await dispatcher.scaleUpOneStep();
|
|
588
|
-
|
|
589
|
-
expect(dispatcher.workerCount).toBe(90);
|
|
590
|
-
expect([...dispatcher.workerPool.values()].map((workers) => workers.length)).toEqual([
|
|
591
|
-
15, 15, 15, 15, 15, 15,
|
|
592
|
-
]);
|
|
593
|
-
expect(estimateOpenAIWorkerRssGiB(dispatcher.workerCount)).toBeLessThan(16);
|
|
594
|
-
});
|
|
595
|
-
|
|
596
|
-
it("requests a scale-up evaluation when a request enters the queue", async () => {
|
|
597
|
-
const dispatcher = new OpenAIDispatcher(autoscaleConfig(), () => 64);
|
|
598
|
-
addWorkers(dispatcher, [fakeWorker({ tokenId: 1, busy: true })]);
|
|
599
|
-
const scaleUpOneStep = vi.spyOn(dispatcher, "scaleUpOneStep").mockResolvedValue(undefined);
|
|
600
|
-
|
|
601
|
-
const queued = dispatcher.enqueue(async () => "ok");
|
|
602
|
-
const rejection = expect(queued).rejects.toThrow("TEST_CLEANUP");
|
|
603
|
-
await waitForQueue(dispatcher);
|
|
604
|
-
dispatcher.rejectAllQueued("TEST_CLEANUP");
|
|
605
|
-
|
|
606
|
-
await rejection;
|
|
607
|
-
expect(scaleUpOneStep).toHaveBeenCalledTimes(1);
|
|
608
|
-
});
|
|
609
|
-
|
|
610
|
-
it("adds one worker to each active token in a scale-up step", async () => {
|
|
611
|
-
const dispatcher = new OpenAIDispatcher(autoscaleConfig(), () => 64);
|
|
612
|
-
const tokenCredentials = credentials();
|
|
613
|
-
vi.spyOn(dispatcher, "spawnWorkers").mockResolvedValue(undefined);
|
|
614
|
-
await dispatcher.onTokenAdded(1, "token", tokenCredentials, null, 1);
|
|
615
|
-
dispatcher.workerPool.set(1, [fakeWorker({ tokenId: 1, workerIndex: 0 })]);
|
|
616
|
-
const added = fakeWorker({ tokenId: 1, workerIndex: 1 });
|
|
617
|
-
const spawnSingleWorker = vi.spyOn(dispatcher, "spawnSingleWorker").mockResolvedValue(added);
|
|
618
|
-
|
|
619
|
-
await dispatcher.scaleUpOneStep();
|
|
620
95
|
|
|
621
|
-
expect(
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
const nkCredentials = credentials({ accountId: "nk" });
|
|
630
|
-
vi.spyOn(dispatcher, "spawnWorkers").mockResolvedValue(undefined);
|
|
631
|
-
await dispatcher.onTokenAdded(1, "openai/haze", hazeCredentials, 80, 1);
|
|
632
|
-
await dispatcher.onTokenAdded(2, "openai/nk", nkCredentials, null, 1);
|
|
633
|
-
dispatcher.workerPool.set(1, [
|
|
634
|
-
fakeWorker({ tokenId: 1, tokenName: "openai/haze", workerIndex: 0 }),
|
|
635
|
-
]);
|
|
636
|
-
dispatcher.workerPool.set(2, [
|
|
637
|
-
fakeWorker({ tokenId: 2, tokenName: "openai/nk", workerIndex: 0 }),
|
|
638
|
-
]);
|
|
639
|
-
readOpenAIQuotaUsageMock.mockResolvedValue(quotaOk(85));
|
|
640
|
-
|
|
641
|
-
const selected = await dispatcher.acquireIdleWorker();
|
|
642
|
-
expect(selected?.tokenName).toBe("openai/nk");
|
|
643
|
-
selected?.releaseTurn();
|
|
644
|
-
|
|
645
|
-
const spawnSingleWorker = vi
|
|
646
|
-
.spyOn(dispatcher, "spawnSingleWorker")
|
|
647
|
-
.mockImplementation(async (tokenId, tokenName, _credentials, workerIndex) =>
|
|
648
|
-
fakeWorker({ tokenId, tokenName, workerIndex }),
|
|
649
|
-
);
|
|
650
|
-
await dispatcher.scaleUpOneStep();
|
|
651
|
-
|
|
652
|
-
expect(spawnSingleWorker).toHaveBeenCalledTimes(1);
|
|
653
|
-
expect(spawnSingleWorker).toHaveBeenCalledWith(2, "openai/nk", nkCredentials, 1);
|
|
654
|
-
expect(dispatcher.workerPool.get(1)).toHaveLength(1);
|
|
655
|
-
expect(dispatcher.workerPool.get(2)).toHaveLength(2);
|
|
656
|
-
});
|
|
657
|
-
|
|
658
|
-
it("maintains the configured minimum for a quota-blocked token", async () => {
|
|
659
|
-
const dispatcher = new OpenAIDispatcher(autoscaleConfig(), () => 64);
|
|
660
|
-
const tokenCredentials = credentials({ accountId: "haze" });
|
|
661
|
-
vi.spyOn(dispatcher, "spawnWorkers").mockResolvedValue(undefined);
|
|
662
|
-
await dispatcher.onTokenAdded(1, "openai/haze", tokenCredentials, 80, 1);
|
|
663
|
-
dispatcher.workerPool.set(1, [
|
|
664
|
-
fakeWorker({ tokenId: 1, tokenName: "openai/haze", workerIndex: 0 }),
|
|
665
|
-
]);
|
|
666
|
-
readOpenAIQuotaUsageMock.mockResolvedValue(quotaOk(85));
|
|
667
|
-
|
|
668
|
-
await expect(dispatcher.acquireIdleWorker()).rejects.toBeInstanceOf(
|
|
669
|
-
QuotaThresholdExceededError,
|
|
670
|
-
);
|
|
671
|
-
dispatcher.workerPool.delete(1);
|
|
672
|
-
const replacement = fakeWorker({
|
|
673
|
-
tokenId: 1,
|
|
674
|
-
tokenName: "openai/haze",
|
|
675
|
-
workerIndex: 0,
|
|
96
|
+
expect(mapped).toMatchObject({
|
|
97
|
+
model: "gpt-test",
|
|
98
|
+
instructions: "system",
|
|
99
|
+
reasoning: { effort: "high" },
|
|
100
|
+
verbosity: "low",
|
|
101
|
+
serviceTier: "priority",
|
|
102
|
+
promptCacheKey: "cache-key",
|
|
103
|
+
outputSchema: { schema: { type: "object", additionalProperties: false } },
|
|
676
104
|
});
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
await dispatcher.evaluateAutoscaling();
|
|
682
|
-
|
|
683
|
-
expect(spawnSingleWorker).toHaveBeenCalledWith(
|
|
684
|
-
1,
|
|
685
|
-
"openai/haze",
|
|
686
|
-
tokenCredentials,
|
|
687
|
-
0,
|
|
688
|
-
);
|
|
689
|
-
expect(dispatcher.workerPool.get(1)).toEqual([replacement]);
|
|
690
|
-
});
|
|
691
|
-
|
|
692
|
-
it("discards a worker spawned while its token becomes quota-blocked", async () => {
|
|
693
|
-
const dispatcher = new OpenAIDispatcher(autoscaleConfig(), () => 64);
|
|
694
|
-
const tokenCredentials = credentials();
|
|
695
|
-
vi.spyOn(dispatcher, "spawnWorkers").mockResolvedValue(undefined);
|
|
696
|
-
await dispatcher.onTokenAdded(1, "openai/haze", tokenCredentials, 80, 1);
|
|
697
|
-
dispatcher.workerPool.set(1, [
|
|
698
|
-
fakeWorker({ tokenId: 1, tokenName: "openai/haze", workerIndex: 0 }),
|
|
105
|
+
expect(mapped?.reasoning).not.toHaveProperty("summary");
|
|
106
|
+
expect(mapped?.history).toEqual([
|
|
107
|
+
{ type: "message", role: "assistant", content: "old" },
|
|
108
|
+
{ type: "message", role: "user", content: [{ type: "input_text", text: "new" }] },
|
|
699
109
|
]);
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
110
|
+
expect(result).toMatchObject({
|
|
111
|
+
text: "hello",
|
|
112
|
+
tokenName: "primary",
|
|
113
|
+
usage: {
|
|
114
|
+
inputTokens: 8,
|
|
115
|
+
cachedInputTokens: 3,
|
|
116
|
+
outputTokens: 2,
|
|
117
|
+
reasoningOutputTokens: 1,
|
|
118
|
+
totalTokens: 10,
|
|
119
|
+
},
|
|
120
|
+
threadCoord: { workerId: 7, threadId: "cache-key", epoch: -1 },
|
|
707
121
|
});
|
|
708
|
-
const spawnSingleWorker = vi.spyOn(dispatcher, "spawnSingleWorker").mockImplementation(
|
|
709
|
-
() =>
|
|
710
|
-
new Promise<CodexAppServerWorker>((resolve) => {
|
|
711
|
-
resolveSpawn = resolve;
|
|
712
|
-
}),
|
|
713
|
-
);
|
|
714
|
-
|
|
715
|
-
const scaling = dispatcher.scaleUpOneStep();
|
|
716
|
-
await vi.waitFor(() => expect(spawnSingleWorker).toHaveBeenCalledTimes(1));
|
|
717
|
-
await expect(dispatcher.acquireIdleWorker()).rejects.toBeInstanceOf(
|
|
718
|
-
QuotaThresholdExceededError,
|
|
719
|
-
);
|
|
720
|
-
resolveSpawn(spawnedWorker);
|
|
721
|
-
await scaling;
|
|
722
|
-
|
|
723
|
-
expect(spawnedWorker.kill).toHaveBeenCalledTimes(1);
|
|
724
|
-
expect(dispatcher.workerPool.get(1)).toHaveLength(1);
|
|
725
122
|
});
|
|
726
123
|
|
|
727
|
-
it("
|
|
728
|
-
const
|
|
729
|
-
|
|
730
|
-
|
|
124
|
+
it("streams deltas and reports completion", async () => {
|
|
125
|
+
const d = dispatcher(() =>
|
|
126
|
+
events(
|
|
127
|
+
{ type: "text-delta", text: "a" },
|
|
128
|
+
{ type: "text-delta", text: "b" },
|
|
129
|
+
{ type: "completed", responseId: "r" },
|
|
130
|
+
),
|
|
731
131
|
);
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
expect(
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
it("does not scale when host available memory is below the floor", async () => {
|
|
744
|
-
const dispatcher = new OpenAIDispatcher(autoscaleConfig(), () => 10);
|
|
745
|
-
vi.spyOn(dispatcher, "spawnWorkers").mockResolvedValue(undefined);
|
|
746
|
-
await dispatcher.onTokenAdded(1, "token", credentials(), null, 1);
|
|
747
|
-
dispatcher.workerPool.set(1, [fakeWorker({ tokenId: 1, workerIndex: 0 })]);
|
|
748
|
-
const spawnSingleWorker = vi.spyOn(dispatcher, "spawnSingleWorker");
|
|
749
|
-
|
|
750
|
-
await dispatcher.scaleUpOneStep();
|
|
751
|
-
|
|
752
|
-
expect(spawnSingleWorker).not.toHaveBeenCalled();
|
|
753
|
-
expect(dispatcher.workerCount).toBe(1);
|
|
754
|
-
});
|
|
755
|
-
|
|
756
|
-
it("removes only idle workers above the configured minimum for inactive tokens", async () => {
|
|
757
|
-
const dispatcher = new OpenAIDispatcher(autoscaleConfig(), () => 64);
|
|
758
|
-
vi.spyOn(dispatcher, "spawnWorkers").mockResolvedValue(undefined);
|
|
759
|
-
await dispatcher.onTokenAdded(1, "token", credentials(), null, 1);
|
|
760
|
-
const busy = fakeWorker({ tokenId: 1, workerIndex: 0, busy: true });
|
|
761
|
-
const idle = fakeWorker({ tokenId: 1, workerIndex: 1 });
|
|
762
|
-
dispatcher.workerPool.set(1, [busy, idle]);
|
|
763
|
-
dispatcher.onTokenDeactivated(1);
|
|
764
|
-
|
|
765
|
-
await dispatcher.scaleDownOneStep();
|
|
766
|
-
await dispatcher.scaleDownOneStep();
|
|
767
|
-
|
|
768
|
-
expect(idle.kill).toHaveBeenCalledTimes(1);
|
|
769
|
-
expect(busy.kill).not.toHaveBeenCalled();
|
|
770
|
-
expect(dispatcher.workerPool.get(1)).toEqual([busy]);
|
|
771
|
-
});
|
|
772
|
-
|
|
773
|
-
it.each([1, 2, 5])(
|
|
774
|
-
"converges repeated idle evaluations to configured minimum %i and never below it",
|
|
775
|
-
async (minimum) => {
|
|
776
|
-
vi.useFakeTimers();
|
|
777
|
-
try {
|
|
778
|
-
vi.setSystemTime(1_000);
|
|
779
|
-
const initialCount = minimum + 3;
|
|
780
|
-
const dispatcher = new OpenAIDispatcher(
|
|
781
|
-
autoscaleConfig({
|
|
782
|
-
minWorkersPerToken: minimum,
|
|
783
|
-
maxWorkersPerToken: initialCount,
|
|
784
|
-
scaleDownIdleMs: 1_000,
|
|
785
|
-
}),
|
|
786
|
-
() => 64,
|
|
787
|
-
);
|
|
788
|
-
vi.spyOn(dispatcher, "spawnWorkers").mockResolvedValue(undefined);
|
|
789
|
-
await dispatcher.onTokenAdded(1, "token", credentials(), null, 1);
|
|
790
|
-
const workers = Array.from({ length: initialCount }, (_, workerIndex) =>
|
|
791
|
-
fakeWorker({ tokenId: 1, workerIndex }),
|
|
792
|
-
);
|
|
793
|
-
dispatcher.workerPool.set(1, workers);
|
|
794
|
-
vi.setSystemTime(2_001);
|
|
795
|
-
|
|
796
|
-
await dispatcher.evaluateAutoscaling();
|
|
797
|
-
expect(dispatcher.workerPool.get(1)).toHaveLength(initialCount - 1);
|
|
798
|
-
await dispatcher.evaluateAutoscaling();
|
|
799
|
-
expect(dispatcher.workerPool.get(1)).toHaveLength(initialCount - 2);
|
|
800
|
-
await dispatcher.evaluateAutoscaling();
|
|
801
|
-
expect(dispatcher.workerPool.get(1)).toHaveLength(minimum);
|
|
802
|
-
await dispatcher.evaluateAutoscaling();
|
|
803
|
-
expect(dispatcher.workerPool.get(1)).toHaveLength(minimum);
|
|
804
|
-
|
|
805
|
-
for (let workerIndex = minimum; workerIndex < initialCount; workerIndex++) {
|
|
806
|
-
expect(workers[workerIndex]?.kill).toHaveBeenCalledTimes(1);
|
|
807
|
-
}
|
|
808
|
-
for (let workerIndex = 0; workerIndex < minimum; workerIndex++) {
|
|
809
|
-
expect(workers[workerIndex]?.kill).not.toHaveBeenCalled();
|
|
810
|
-
}
|
|
811
|
-
} finally {
|
|
812
|
-
vi.useRealTimers();
|
|
813
|
-
}
|
|
814
|
-
},
|
|
815
|
-
);
|
|
816
|
-
|
|
817
|
-
it("still scales healthy idle pools down when another token cannot recover its minimum", async () => {
|
|
818
|
-
vi.useFakeTimers();
|
|
819
|
-
try {
|
|
820
|
-
vi.setSystemTime(1_000);
|
|
821
|
-
const dispatcher = new OpenAIDispatcher(
|
|
822
|
-
autoscaleConfig({ scaleDownIdleMs: 1_000 }),
|
|
823
|
-
() => 64,
|
|
824
|
-
);
|
|
825
|
-
vi.spyOn(dispatcher, "spawnWorkers").mockResolvedValue(undefined);
|
|
826
|
-
await dispatcher.onTokenAdded(1, "broken", credentials(), null, 1);
|
|
827
|
-
await dispatcher.onTokenAdded(2, "healthy", credentials(), null, 1);
|
|
828
|
-
const healthyWorkers = [
|
|
829
|
-
fakeWorker({ tokenId: 2, tokenName: "healthy", workerIndex: 0 }),
|
|
830
|
-
fakeWorker({ tokenId: 2, tokenName: "healthy", workerIndex: 1 }),
|
|
831
|
-
];
|
|
832
|
-
dispatcher.workerPool.set(2, healthyWorkers);
|
|
833
|
-
vi.spyOn(dispatcher, "spawnSingleWorker").mockResolvedValue(null);
|
|
834
|
-
vi.setSystemTime(2_001);
|
|
835
|
-
|
|
836
|
-
await dispatcher.evaluateAutoscaling();
|
|
837
|
-
|
|
838
|
-
expect(dispatcher.workerPool.get(2)).toEqual([healthyWorkers[0]]);
|
|
839
|
-
expect(healthyWorkers[1]?.kill).toHaveBeenCalledTimes(1);
|
|
840
|
-
} finally {
|
|
841
|
-
vi.useRealTimers();
|
|
842
|
-
}
|
|
843
|
-
});
|
|
844
|
-
|
|
845
|
-
it("removes a terminal worker by identity and requests minimum repair", async () => {
|
|
846
|
-
const dispatcher = new OpenAIDispatcher(autoscaleConfig(), () => 64);
|
|
847
|
-
vi.spyOn(dispatcher, "spawnWorkers").mockResolvedValue(undefined);
|
|
848
|
-
await dispatcher.onTokenAdded(1, "token", credentials(), null, 1);
|
|
849
|
-
const terminal = fakeWorker({ tokenId: 1, workerIndex: 0, ready: false });
|
|
850
|
-
dispatcher.workerPool.set(1, [terminal]);
|
|
851
|
-
const evaluateAutoscaling = vi
|
|
852
|
-
.spyOn(dispatcher, "evaluateAutoscaling")
|
|
853
|
-
.mockResolvedValue(undefined);
|
|
854
|
-
|
|
855
|
-
await dispatcher.handleWorkerTerminalFailure(terminal);
|
|
856
|
-
|
|
857
|
-
expect(dispatcher.workerPool.has(1)).toBe(false);
|
|
858
|
-
expect(terminal.kill).toHaveBeenCalledTimes(1);
|
|
859
|
-
expect(evaluateAutoscaling).toHaveBeenCalledTimes(1);
|
|
132
|
+
await d.onTokenAdded(1, "one", credentials);
|
|
133
|
+
const deltas: string[] = [];
|
|
134
|
+
const complete = vi.fn();
|
|
135
|
+
await d.generateStream(request(), {
|
|
136
|
+
onDelta: (v) => deltas.push(v),
|
|
137
|
+
onComplete: complete,
|
|
138
|
+
onError: vi.fn(),
|
|
139
|
+
});
|
|
140
|
+
expect(deltas).toEqual(["a", "b"]);
|
|
141
|
+
expect(complete).toHaveBeenCalledWith(expect.objectContaining({ text: "ab" }));
|
|
860
142
|
});
|
|
861
143
|
|
|
862
|
-
it("
|
|
863
|
-
const
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
}),
|
|
869
|
-
() => 64,
|
|
870
|
-
);
|
|
871
|
-
vi.spyOn(dispatcher, "spawnWorkers").mockResolvedValue(undefined);
|
|
872
|
-
await dispatcher.onTokenAdded(1, "token", credentials(), null, 1);
|
|
873
|
-
const terminal = fakeWorker({ tokenId: 1, workerIndex: 0, ready: false });
|
|
874
|
-
const survivor = fakeWorker({ tokenId: 1, workerIndex: 1 });
|
|
875
|
-
const excess = fakeWorker({ tokenId: 1, workerIndex: 2 });
|
|
876
|
-
dispatcher.workerPool.set(1, [terminal, survivor, excess]);
|
|
877
|
-
|
|
878
|
-
await dispatcher.scaleDownOneStep();
|
|
879
|
-
expect(dispatcher.workerPool.get(1)).toEqual([terminal, survivor]);
|
|
880
|
-
|
|
881
|
-
const replacement = fakeWorker({ tokenId: 1, workerIndex: 0 });
|
|
882
|
-
vi.spyOn(dispatcher, "spawnSingleWorker").mockResolvedValue(replacement);
|
|
883
|
-
await dispatcher.handleWorkerTerminalFailure(terminal);
|
|
884
|
-
await vi.waitFor(() =>
|
|
885
|
-
expect(dispatcher.workerPool.get(1)).toEqual([replacement, survivor]),
|
|
144
|
+
it("maps images and preserves image failure classifications", async () => {
|
|
145
|
+
const success = dispatcher(() =>
|
|
146
|
+
events(
|
|
147
|
+
{ type: "image", id: "i", base64: "png", mimeType: "image/png" },
|
|
148
|
+
{ type: "completed", responseId: "r" },
|
|
149
|
+
),
|
|
886
150
|
);
|
|
887
|
-
|
|
888
|
-
expect(
|
|
889
|
-
|
|
890
|
-
expect(dispatcher.workerPool.get(1)).toHaveLength(2);
|
|
891
|
-
});
|
|
892
|
-
|
|
893
|
-
it("ignores a stale terminal callback after the token pool was replaced", async () => {
|
|
894
|
-
const dispatcher = new OpenAIDispatcher(autoscaleConfig(), () => 64);
|
|
895
|
-
vi.spyOn(dispatcher, "spawnWorkers").mockResolvedValue(undefined);
|
|
896
|
-
await dispatcher.onTokenAdded(1, "token", credentials(), null, 1);
|
|
897
|
-
const stale = fakeWorker({ tokenId: 1, workerIndex: 0, ready: false });
|
|
898
|
-
const current = fakeWorker({ tokenId: 1, workerIndex: 0 });
|
|
899
|
-
dispatcher.workerPool.set(1, [current]);
|
|
900
|
-
const evaluateAutoscaling = vi.spyOn(dispatcher, "evaluateAutoscaling");
|
|
901
|
-
|
|
902
|
-
await dispatcher.handleWorkerTerminalFailure(stale);
|
|
903
|
-
|
|
904
|
-
expect(dispatcher.workerPool.get(1)).toEqual([current]);
|
|
905
|
-
expect(current.kill).not.toHaveBeenCalled();
|
|
906
|
-
expect(evaluateAutoscaling).not.toHaveBeenCalled();
|
|
907
|
-
});
|
|
908
|
-
|
|
909
|
-
it("wires a spawned worker terminal signal to dispatcher cleanup", async () => {
|
|
910
|
-
const initialize = vi
|
|
911
|
-
.spyOn(CodexAppServerWorker.prototype, "initialize")
|
|
912
|
-
.mockResolvedValue(undefined);
|
|
913
|
-
const kill = vi.spyOn(CodexAppServerWorker.prototype, "kill").mockResolvedValue(undefined);
|
|
914
|
-
const dispatcher = new OpenAIDispatcher(autoscaleConfig(), () => 64);
|
|
915
|
-
|
|
916
|
-
try {
|
|
917
|
-
await dispatcher.spawnWorkers(1, "token", credentials(), null, 1);
|
|
918
|
-
const worker = dispatcher.workerPool.get(1)?.[0];
|
|
919
|
-
expect(worker).toBeDefined();
|
|
920
|
-
const evaluateAutoscaling = vi
|
|
921
|
-
.spyOn(dispatcher, "evaluateAutoscaling")
|
|
922
|
-
.mockResolvedValue(undefined);
|
|
923
|
-
|
|
924
|
-
worker?.onTerminalFailure?.();
|
|
925
|
-
await vi.waitFor(() => expect(evaluateAutoscaling).toHaveBeenCalledTimes(1));
|
|
926
|
-
|
|
927
|
-
expect(kill).toHaveBeenCalledTimes(1);
|
|
928
|
-
expect(dispatcher.workerPool.has(1)).toBe(false);
|
|
929
|
-
} finally {
|
|
930
|
-
initialize.mockRestore();
|
|
931
|
-
kill.mockRestore();
|
|
932
|
-
}
|
|
933
|
-
});
|
|
934
|
-
});
|
|
935
|
-
|
|
936
|
-
describe("OpenAIDispatcher token updates", () => {
|
|
937
|
-
it("keeps existing workers when only OpenAI auth tokens rotate", async () => {
|
|
938
|
-
const dispatcher = new OpenAIDispatcher();
|
|
939
|
-
const worker = fakeWorker(true);
|
|
940
|
-
const spawnWorkers = vi.spyOn(dispatcher, "spawnWorkers").mockResolvedValue(undefined);
|
|
941
|
-
dispatcher.workerPool.set(1, [worker]);
|
|
942
|
-
|
|
943
|
-
const rotated = credentials({
|
|
944
|
-
accessToken: "new-access",
|
|
945
|
-
refreshToken: "new-refresh",
|
|
946
|
-
idToken: "new-id",
|
|
947
|
-
accessTokenExpiresAt: Date.now() + 120_000,
|
|
151
|
+
await success.onTokenAdded(1, "one", credentials);
|
|
152
|
+
await expect(success.generate(request({ imageGeneration: true }))).resolves.toMatchObject({
|
|
153
|
+
images: [{ data: "png" }],
|
|
948
154
|
});
|
|
949
|
-
await dispatcher.onTokenUpdated(1, "renamed-token", rotated, 80);
|
|
950
|
-
|
|
951
|
-
expect(worker.kill).not.toHaveBeenCalled();
|
|
952
|
-
expect(worker.updateTokenState).toHaveBeenCalledWith("renamed-token", rotated);
|
|
953
|
-
expect(spawnWorkers).not.toHaveBeenCalled();
|
|
954
|
-
expect(dispatcher.workerPool.get(1)).toEqual([worker]);
|
|
955
|
-
});
|
|
956
|
-
|
|
957
|
-
it("restarts workers when the OpenAI login identity changes", async () => {
|
|
958
|
-
const dispatcher = new OpenAIDispatcher();
|
|
959
|
-
const worker = fakeWorker(false);
|
|
960
|
-
const spawnWorkers = vi.spyOn(dispatcher, "spawnWorkers").mockResolvedValue(undefined);
|
|
961
|
-
dispatcher.workerPool.set(1, [worker]);
|
|
962
155
|
|
|
963
|
-
const
|
|
964
|
-
await
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
expect(spawnWorkers).toHaveBeenCalledWith(1, "token", changedIdentity, null, 1);
|
|
968
|
-
});
|
|
969
|
-
|
|
970
|
-
it("uses tokenId keyed rate-limit cache", async () => {
|
|
971
|
-
const dispatcher = new OpenAIDispatcher();
|
|
972
|
-
const rateLimitsA = { rateLimits: { primary: { usedPercent: 10 } }, rateLimitsByLimitId: null };
|
|
973
|
-
const rateLimitsB = { rateLimits: { primary: { usedPercent: 20 } }, rateLimitsByLimitId: null };
|
|
974
|
-
const workerA = fakeWorker({ tokenId: 1, tokenName: "same-name", rateLimits: rateLimitsA });
|
|
975
|
-
const workerB = fakeWorker({ tokenId: 2, tokenName: "same-name", rateLimits: rateLimitsB });
|
|
976
|
-
addWorkers(dispatcher, [workerA, workerB]);
|
|
977
|
-
|
|
978
|
-
await expect(dispatcher.getRateLimitsByTokenId(1)).resolves.toMatchObject({
|
|
979
|
-
data: rateLimitsA,
|
|
156
|
+
const notCalled = dispatcher(() => events({ type: "completed", responseId: "r" }));
|
|
157
|
+
await notCalled.onTokenAdded(1, "one", credentials);
|
|
158
|
+
await expect(notCalled.generate(request({ imageGeneration: true }))).rejects.toMatchObject({
|
|
159
|
+
kind: "not_called",
|
|
980
160
|
});
|
|
981
|
-
await expect(
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
expect(workerA.getRateLimits).toHaveBeenCalledTimes(1);
|
|
989
|
-
expect(workerB.getRateLimits).toHaveBeenCalledTimes(1);
|
|
161
|
+
await expect(
|
|
162
|
+
notCalled.generateStream(request({ imageGeneration: true }), {
|
|
163
|
+
onDelta: vi.fn(),
|
|
164
|
+
onComplete: vi.fn(),
|
|
165
|
+
onError: vi.fn(),
|
|
166
|
+
}),
|
|
167
|
+
).rejects.toEqual(expect.any(ImageGenerationError));
|
|
990
168
|
});
|
|
991
169
|
|
|
992
|
-
it("
|
|
993
|
-
const
|
|
994
|
-
const
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
170
|
+
it("uses weighted routing, while preferred affinity does not advance weighted state", async () => {
|
|
171
|
+
const names: string[] = [];
|
|
172
|
+
const d = dispatcher(() => events({ type: "completed", responseId: "r" }));
|
|
173
|
+
await d.onTokenAdded(1, "one", credentials, null, 1);
|
|
174
|
+
await d.onTokenAdded(2, "two", { ...credentials, accountId: "acct2" }, null, 2);
|
|
175
|
+
for (let i = 0; i < 6; i++) names.push((await d.generate(request())).tokenName);
|
|
176
|
+
expect(names.filter((n) => n === "two")).toHaveLength(4);
|
|
177
|
+
expect((await d.generate(request({ preferredTokenId: 1 }))).tokenName).toBe("one");
|
|
178
|
+
expect((await d.generate(request())).tokenName).toBe("two");
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
it("runs concurrent requests without queueing and tracks in-flight counts", async () => {
|
|
182
|
+
const releases: Array<() => void> = [];
|
|
183
|
+
const d = dispatcher(() => ({
|
|
184
|
+
async *[Symbol.asyncIterator]() {
|
|
185
|
+
await new Promise<void>((resolve) => releases.push(resolve));
|
|
186
|
+
yield { type: "completed", responseId: "r" } as const;
|
|
187
|
+
},
|
|
188
|
+
}));
|
|
189
|
+
await d.onTokenAdded(1, "one", credentials);
|
|
190
|
+
|
|
191
|
+
// 동시성 상한이 없다: 토큰 하나에 세 요청이 즉시 모두 시작된다.
|
|
192
|
+
const first = d.generate(request());
|
|
193
|
+
const second = d.generate(request());
|
|
194
|
+
const third = d.generate(request());
|
|
195
|
+
await vi.waitFor(() => expect(releases).toHaveLength(3));
|
|
196
|
+
expect(d.inFlight).toBe(3);
|
|
197
|
+
|
|
198
|
+
for (const release of releases.splice(0)) release();
|
|
199
|
+
await Promise.all([first, second, third]);
|
|
200
|
+
expect(d.inFlight).toBe(0);
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
it("aborts active transport work through the caller signal", async () => {
|
|
204
|
+
const d = dispatcher((_options, signal) => ({
|
|
205
|
+
async *[Symbol.asyncIterator]() {
|
|
206
|
+
await new Promise<void>((_resolve, reject) => {
|
|
207
|
+
signal?.addEventListener(
|
|
208
|
+
"abort",
|
|
209
|
+
() => reject(new DOMException("Aborted", "AbortError")),
|
|
210
|
+
{ once: true },
|
|
211
|
+
);
|
|
212
|
+
});
|
|
213
|
+
yield { type: "completed", responseId: "r" } as const;
|
|
214
|
+
},
|
|
215
|
+
}));
|
|
216
|
+
await d.onTokenAdded(1, "one", credentials);
|
|
217
|
+
const controller = new AbortController();
|
|
218
|
+
const pending = d.generate(request({ abortSignal: controller.signal }));
|
|
219
|
+
await tickTimer();
|
|
220
|
+
controller.abort();
|
|
221
|
+
await expect(pending).rejects.toMatchObject({ name: "AbortError" });
|
|
222
|
+
expect(d.inFlight).toBe(0);
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
it("rechecks abort after delayed quota selection and does not start the request", async () => {
|
|
226
|
+
let releaseQuota!: () => void;
|
|
227
|
+
const started = vi.fn(() => events({ type: "completed", responseId: "r" }));
|
|
228
|
+
const d = new OpenAIDispatcher(config(), {
|
|
229
|
+
clientFactory: () => ({ responses: started }),
|
|
230
|
+
fetch: async () => {
|
|
231
|
+
await new Promise<void>((resolve) => (releaseQuota = resolve));
|
|
232
|
+
return new Response(
|
|
233
|
+
JSON.stringify({
|
|
234
|
+
rate_limits: { primary_window: { used_percent: 1 } },
|
|
235
|
+
}),
|
|
236
|
+
{ status: 200 },
|
|
237
|
+
);
|
|
238
|
+
},
|
|
1002
239
|
});
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
await
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
240
|
+
await d.onTokenAdded(1, "one", credentials, 80);
|
|
241
|
+
const controller = new AbortController();
|
|
242
|
+
const pending = d.generate(request({ abortSignal: controller.signal }));
|
|
243
|
+
await vi.waitFor(() => expect(releaseQuota).toBeTypeOf("function"));
|
|
244
|
+
controller.abort();
|
|
245
|
+
releaseQuota();
|
|
246
|
+
await expect(pending).rejects.toMatchObject({ name: "AbortError" });
|
|
247
|
+
expect(started).not.toHaveBeenCalled();
|
|
248
|
+
await expect(d.generate(request())).resolves.toMatchObject({ tokenName: "one" });
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
it("enforces timeout during an active response stream", async () => {
|
|
252
|
+
let calls = 0;
|
|
253
|
+
const d = dispatcher((_options, signal) => ({
|
|
254
|
+
async *[Symbol.asyncIterator]() {
|
|
255
|
+
calls++;
|
|
256
|
+
if (calls === 1) {
|
|
257
|
+
await new Promise<void>((_resolve, reject) =>
|
|
258
|
+
signal?.addEventListener("abort", () => reject(signal.reason), { once: true }),
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
yield { type: "completed", responseId: "r" } as const;
|
|
262
|
+
},
|
|
263
|
+
}));
|
|
264
|
+
await d.onTokenAdded(1, "one", credentials);
|
|
265
|
+
await expect(d.generate(request({ timeoutMs: 5 }))).rejects.toMatchObject({
|
|
266
|
+
name: "TimeoutError",
|
|
1010
267
|
});
|
|
1011
|
-
|
|
1012
|
-
expect(worker.getRateLimits).toHaveBeenCalledTimes(1);
|
|
268
|
+
await expect(d.generate(request())).resolves.toMatchObject({ tokenName: "one" });
|
|
1013
269
|
});
|
|
1014
270
|
|
|
1015
|
-
it("
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
};
|
|
1025
|
-
|
|
1026
|
-
const
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
271
|
+
it("applies credential metadata updates while requests are active", async () => {
|
|
272
|
+
let release!: () => void;
|
|
273
|
+
let call = 0;
|
|
274
|
+
const d = dispatcher(() => ({
|
|
275
|
+
async *[Symbol.asyncIterator]() {
|
|
276
|
+
call++;
|
|
277
|
+
if (call === 1) await new Promise<void>((resolve) => (release = resolve));
|
|
278
|
+
yield { type: "completed", responseId: "r" } as const;
|
|
279
|
+
},
|
|
280
|
+
}));
|
|
281
|
+
await d.onTokenAdded(1, "old", credentials);
|
|
282
|
+
const active = d.generate(request());
|
|
283
|
+
await vi.waitFor(() => expect(call).toBe(1));
|
|
284
|
+
await d.onTokenUpdated(1, "new", { ...credentials, accessToken: "replacement" });
|
|
285
|
+
release();
|
|
286
|
+
await active;
|
|
287
|
+
await expect(d.generate(request())).resolves.toMatchObject({ tokenName: "new" });
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
it("retires a replaced client only after its in-flight requests finish", async () => {
|
|
291
|
+
let release!: () => void;
|
|
292
|
+
let call = 0;
|
|
293
|
+
const close = vi.fn();
|
|
294
|
+
const d = new OpenAIDispatcher(config(), {
|
|
295
|
+
clientFactory: () => ({
|
|
296
|
+
responses: () => ({
|
|
297
|
+
async *[Symbol.asyncIterator]() {
|
|
298
|
+
call++;
|
|
299
|
+
if (call === 1) await new Promise<void>((resolve) => (release = resolve));
|
|
300
|
+
yield { type: "completed", responseId: "r" } as const;
|
|
301
|
+
},
|
|
302
|
+
}),
|
|
303
|
+
close,
|
|
304
|
+
}),
|
|
1038
305
|
});
|
|
1039
|
-
|
|
1040
|
-
const
|
|
1041
|
-
await vi.waitFor(() => expect(
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
306
|
+
await d.onTokenAdded(1, "old", credentials);
|
|
307
|
+
const active = d.generate(request());
|
|
308
|
+
await vi.waitFor(() => expect(call).toBe(1));
|
|
309
|
+
|
|
310
|
+
await d.onTokenUpdated(1, "new", { ...credentials, accessToken: "replacement" });
|
|
311
|
+
// 세대 교체는 새 요청이 새 client 를 만들 뿐, 진행 중인 client 를 끊지 않는다.
|
|
312
|
+
await expect(d.generate(request())).resolves.toMatchObject({ tokenName: "new" });
|
|
313
|
+
expect(close).not.toHaveBeenCalled();
|
|
314
|
+
|
|
315
|
+
release();
|
|
316
|
+
await expect(active).resolves.toMatchObject({ tokenName: "new" });
|
|
317
|
+
expect(close).toHaveBeenCalledTimes(1);
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
it("cancels a hung quota lookup when the caller aborts", async () => {
|
|
321
|
+
const started = vi.fn(() => events({ type: "completed", responseId: "r" }));
|
|
322
|
+
const d = new OpenAIDispatcher(config(), {
|
|
323
|
+
clientFactory: () => ({ responses: started }),
|
|
324
|
+
fetch: async (_input, init) =>
|
|
325
|
+
new Promise<Response>((_resolve, reject) => {
|
|
326
|
+
const signal = (init as RequestInit | undefined)?.signal;
|
|
327
|
+
if (!signal) return;
|
|
328
|
+
signal.addEventListener("abort", () => reject(signal.reason), { once: true });
|
|
329
|
+
}),
|
|
1053
330
|
});
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
addWorkers(dispatcher, [workerA, workerB]);
|
|
1062
|
-
|
|
1063
|
-
await dispatcher.replaceTokens([
|
|
1064
|
-
{ id: 1, name: "tok-A", credentials: credentials(), quotaThreshold: 80, weight: 1 },
|
|
1065
|
-
]);
|
|
1066
|
-
readOpenAIQuotaUsageMock.mockResolvedValueOnce(quotaOk(85));
|
|
1067
|
-
|
|
1068
|
-
await expect(dispatcher.acquireIdleWorker()).rejects.toBeInstanceOf(
|
|
1069
|
-
QuotaThresholdExceededError,
|
|
1070
|
-
);
|
|
1071
|
-
expect(workerB.kill).toHaveBeenCalledTimes(1);
|
|
331
|
+
await d.onTokenAdded(1, "one", credentials, 80);
|
|
332
|
+
const controller = new AbortController();
|
|
333
|
+
const pending = d.generate(request({ abortSignal: controller.signal }));
|
|
334
|
+
await tickTimer();
|
|
335
|
+
controller.abort();
|
|
336
|
+
await expect(pending).rejects.toMatchObject({ name: "AbortError" });
|
|
337
|
+
expect(started).not.toHaveBeenCalled();
|
|
1072
338
|
});
|
|
1073
|
-
});
|
|
1074
|
-
|
|
1075
|
-
describe("OpenAIDispatcher weighted routing", () => {
|
|
1076
|
-
it("routes cold OpenAI requests by token weight instead of worker count", async () => {
|
|
1077
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1078
|
-
const a0 = fakeWorker({ tokenId: 1, tokenName: "tok-A", workerIndex: 0 });
|
|
1079
|
-
const a1 = fakeWorker({ tokenId: 1, tokenName: "tok-A", workerIndex: 1 });
|
|
1080
|
-
const b0 = fakeWorker({ tokenId: 2, tokenName: "tok-B", workerIndex: 0 });
|
|
1081
|
-
addWorkers(dispatcher, [a0, a1, b0]);
|
|
1082
|
-
await dispatcher.onTokenUpdated(1, "tok-A", credentials(), null, 3);
|
|
1083
|
-
await dispatcher.onTokenUpdated(2, "tok-B", credentials(), null, 1);
|
|
1084
339
|
|
|
340
|
+
it("routes past an over-threshold token instead of treating it as capacity", async () => {
|
|
1085
341
|
const names: string[] = [];
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
expect(names.filter((name) => name === "tok-B")).toHaveLength(1);
|
|
1094
|
-
});
|
|
1095
|
-
|
|
1096
|
-
it("does not give a token extra cold turns for having more workers", async () => {
|
|
1097
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1098
|
-
addWorkers(dispatcher, [
|
|
1099
|
-
fakeWorker({ tokenId: 1, tokenName: "tok-A", workerIndex: 0 }),
|
|
1100
|
-
fakeWorker({ tokenId: 1, tokenName: "tok-A", workerIndex: 1 }),
|
|
1101
|
-
fakeWorker({ tokenId: 2, tokenName: "tok-B", workerIndex: 0 }),
|
|
1102
|
-
]);
|
|
1103
|
-
await dispatcher.onTokenUpdated(1, "tok-A", credentials(), null, 1);
|
|
1104
|
-
await dispatcher.onTokenUpdated(2, "tok-B", credentials(), null, 1);
|
|
1105
|
-
|
|
1106
|
-
const names: string[] = [];
|
|
1107
|
-
for (let i = 0; i < 4; i++) {
|
|
1108
|
-
const worker = await dispatcher.acquireIdleWorker();
|
|
1109
|
-
names.push(worker!.tokenName);
|
|
1110
|
-
worker!.releaseTurn();
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1113
|
-
expect(names).toEqual(["tok-A", "tok-B", "tok-A", "tok-B"]);
|
|
1114
|
-
});
|
|
1115
|
-
|
|
1116
|
-
it("skips a high-weight token when all of its workers are busy", async () => {
|
|
1117
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1118
|
-
addWorkers(dispatcher, [
|
|
1119
|
-
fakeWorker({ tokenId: 1, tokenName: "tok-A", busy: true }),
|
|
1120
|
-
fakeWorker({ tokenId: 2, tokenName: "tok-B" }),
|
|
1121
|
-
]);
|
|
1122
|
-
await dispatcher.onTokenUpdated(1, "tok-A", credentials(), null, 100);
|
|
1123
|
-
await dispatcher.onTokenUpdated(2, "tok-B", credentials(), null, 1);
|
|
1124
|
-
|
|
1125
|
-
await expect(dispatcher.acquireIdleWorker()).resolves.toMatchObject({ tokenName: "tok-B" });
|
|
1126
|
-
});
|
|
1127
|
-
|
|
1128
|
-
it("uses weighted selection when draining after a worker release", async () => {
|
|
1129
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1130
|
-
const workerA = fakeWorker({ tokenId: 1, tokenName: "tok-A", busy: true });
|
|
1131
|
-
const workerB = fakeWorker({ tokenId: 2, tokenName: "tok-B", busy: true });
|
|
1132
|
-
addWorkers(dispatcher, [workerA, workerB]);
|
|
1133
|
-
await dispatcher.onTokenUpdated(1, "tok-A", credentials(), null, 1);
|
|
1134
|
-
await dispatcher.onTokenUpdated(2, "tok-B", credentials(), null, 3);
|
|
1135
|
-
|
|
1136
|
-
const queued = dispatcher.enqueue(async (worker) => worker.tokenName);
|
|
1137
|
-
await waitForQueue(dispatcher);
|
|
1138
|
-
workerA.releaseTurn();
|
|
1139
|
-
workerB.releaseTurn();
|
|
1140
|
-
|
|
1141
|
-
await dispatcher.drainQueue();
|
|
1142
|
-
await expect(queued).resolves.toBe("tok-B");
|
|
1143
|
-
});
|
|
1144
|
-
|
|
1145
|
-
it("does not advance weighted state for successful thread reuse", async () => {
|
|
1146
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1147
|
-
const workerA = fakeWorker({ tokenId: 1, tokenName: "tok-A" });
|
|
1148
|
-
const workerB = fakeWorker({
|
|
1149
|
-
tokenId: 2,
|
|
1150
|
-
tokenName: "tok-B",
|
|
1151
|
-
threads: ["thread-B"],
|
|
1152
|
-
});
|
|
1153
|
-
addWorkers(dispatcher, [workerA, workerB]);
|
|
1154
|
-
await dispatcher.onTokenUpdated(1, "tok-A", credentials(), null, 1);
|
|
1155
|
-
await dispatcher.onTokenUpdated(2, "tok-B", credentials(), null, 1);
|
|
1156
|
-
vi.spyOn(dispatcher, "executeTurn").mockImplementation(
|
|
1157
|
-
async (worker, _req, reuseThreadId) =>
|
|
1158
|
-
resultFor(worker, reuseThreadId ?? "thread-new"),
|
|
1159
|
-
);
|
|
1160
|
-
|
|
1161
|
-
const cold1 = await dispatcher.generate(baseReq());
|
|
1162
|
-
const reused = await dispatcher.generate(
|
|
1163
|
-
baseReq({
|
|
1164
|
-
reuse: { workerId: makeOpenAIWorkerId(2, 0), threadId: "thread-B", epoch: 1 },
|
|
1165
|
-
}),
|
|
1166
|
-
);
|
|
1167
|
-
const cold2 = await dispatcher.generate(baseReq());
|
|
1168
|
-
|
|
1169
|
-
expect([cold1.tokenName, cold2.tokenName]).toEqual(["tok-A", "tok-B"]);
|
|
1170
|
-
expect(reused).toMatchObject({
|
|
1171
|
-
tokenName: "tok-B",
|
|
1172
|
-
threadCoord: { threadId: "thread-B" },
|
|
342
|
+
const d = new OpenAIDispatcher(config(), {
|
|
343
|
+
clientFactory: () => ({ responses: () => events({ type: "completed", responseId: "r" }) }),
|
|
344
|
+
fetch: async () =>
|
|
345
|
+
new Response(
|
|
346
|
+
JSON.stringify({ rate_limits: { primary_window: { used_percent: 90 } } }),
|
|
347
|
+
{ status: 200, headers: { "content-type": "application/json" } },
|
|
348
|
+
),
|
|
1173
349
|
});
|
|
350
|
+
// one: threshold 없음(항상 eligible), two: threshold 초과 → 항상 one 으로 라우팅된다.
|
|
351
|
+
await d.onTokenAdded(1, "one", credentials, null);
|
|
352
|
+
await d.onTokenAdded(2, "two", { ...credentials, accountId: "acct2" }, 80);
|
|
353
|
+
for (let i = 0; i < 4; i++) names.push((await d.generate(request())).tokenName);
|
|
354
|
+
expect(names).toEqual(["one", "one", "one", "one"]);
|
|
1174
355
|
});
|
|
1175
|
-
});
|
|
1176
|
-
|
|
1177
|
-
describe("OpenAIDispatcher quota threshold gate", () => {
|
|
1178
|
-
it("excludes over-threshold tokenIds before idle selection", async () => {
|
|
1179
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1180
|
-
const workerA = fakeWorker({ tokenId: 1, tokenName: "tok-A" });
|
|
1181
|
-
const workerB = fakeWorker({ tokenId: 2, tokenName: "tok-B" });
|
|
1182
|
-
addWorkers(dispatcher, [workerA, workerB]);
|
|
1183
|
-
await dispatcher.onTokenUpdated(1, "tok-A", credentials(), 80);
|
|
1184
|
-
await dispatcher.onTokenUpdated(2, "tok-B", credentials(), 80);
|
|
1185
|
-
readOpenAIQuotaUsageMock.mockResolvedValueOnce(quotaOk(85)).mockResolvedValueOnce(quotaOk(10));
|
|
1186
|
-
|
|
1187
|
-
const worker = await dispatcher.acquireIdleWorker();
|
|
1188
|
-
|
|
1189
|
-
expect(worker?.tokenName).toBe("tok-B");
|
|
1190
|
-
expect(workerA.tryAcquireTurn).not.toHaveBeenCalled();
|
|
1191
|
-
expect(loggerInfoMock).toHaveBeenCalledWith(
|
|
1192
|
-
expect.stringContaining("over_threshold"),
|
|
1193
|
-
expect.objectContaining({
|
|
1194
|
-
tokenId: 1,
|
|
1195
|
-
tokenName: "tok-A",
|
|
1196
|
-
provider: "openai",
|
|
1197
|
-
threshold: 80,
|
|
1198
|
-
cachedUtilization: 85,
|
|
1199
|
-
windowDurationMins: 300,
|
|
1200
|
-
resetsAt: 1_782_912_345,
|
|
1201
|
-
limitId: "codex-primary",
|
|
1202
|
-
reason: "over_threshold",
|
|
1203
|
-
}),
|
|
1204
|
-
);
|
|
1205
|
-
});
|
|
1206
|
-
|
|
1207
|
-
it("logs over-threshold and recovery only when the token gate state changes", async () => {
|
|
1208
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1209
|
-
const worker = fakeWorker({ tokenId: 1, tokenName: "openai/haze" });
|
|
1210
|
-
addWorkers(dispatcher, [worker]);
|
|
1211
|
-
await dispatcher.onTokenUpdated(1, "openai/haze", credentials(), 80);
|
|
1212
|
-
readOpenAIQuotaUsageMock
|
|
1213
|
-
.mockResolvedValueOnce(quotaOk(85))
|
|
1214
|
-
.mockResolvedValueOnce(quotaOk(85))
|
|
1215
|
-
.mockResolvedValueOnce(quotaOk(10))
|
|
1216
|
-
.mockResolvedValueOnce(quotaOk(10));
|
|
1217
|
-
|
|
1218
|
-
await expect(dispatcher.acquireIdleWorker()).rejects.toBeInstanceOf(
|
|
1219
|
-
QuotaThresholdExceededError,
|
|
1220
|
-
);
|
|
1221
|
-
await expect(dispatcher.acquireIdleWorker()).rejects.toBeInstanceOf(
|
|
1222
|
-
QuotaThresholdExceededError,
|
|
1223
|
-
);
|
|
1224
|
-
const recoveredWorker = await dispatcher.acquireIdleWorker();
|
|
1225
|
-
recoveredWorker?.releaseTurn();
|
|
1226
|
-
const stillEligibleWorker = await dispatcher.acquireIdleWorker();
|
|
1227
|
-
stillEligibleWorker?.releaseTurn();
|
|
1228
|
-
|
|
1229
|
-
const overThresholdLogs = loggerInfoMock.mock.calls.filter(([message]) =>
|
|
1230
|
-
String(message).includes("quota_threshold gate: over_threshold"),
|
|
1231
|
-
);
|
|
1232
|
-
const recoveredLogs = loggerInfoMock.mock.calls.filter(([message]) =>
|
|
1233
|
-
String(message).includes("quota_threshold gate: recovered"),
|
|
1234
|
-
);
|
|
1235
|
-
expect(overThresholdLogs).toHaveLength(1);
|
|
1236
|
-
expect(overThresholdLogs[0]).toEqual([
|
|
1237
|
-
"quota_threshold gate: over_threshold openai/haze[1] (85% >= 80%)",
|
|
1238
|
-
expect.objectContaining({
|
|
1239
|
-
tokenId: 1,
|
|
1240
|
-
tokenName: "openai/haze",
|
|
1241
|
-
threshold: 80,
|
|
1242
|
-
cachedUtilization: 85,
|
|
1243
|
-
reason: "over_threshold",
|
|
1244
|
-
}),
|
|
1245
|
-
]);
|
|
1246
|
-
expect(recoveredLogs).toHaveLength(1);
|
|
1247
|
-
expect(recoveredLogs[0]).toEqual([
|
|
1248
|
-
"quota_threshold gate: recovered openai/haze[1] (10% < 80%)",
|
|
1249
|
-
expect.objectContaining({
|
|
1250
|
-
tokenId: 1,
|
|
1251
|
-
tokenName: "openai/haze",
|
|
1252
|
-
threshold: 80,
|
|
1253
|
-
cachedUtilization: 10,
|
|
1254
|
-
reason: "recovered",
|
|
1255
|
-
}),
|
|
1256
|
-
]);
|
|
1257
|
-
});
|
|
1258
|
-
|
|
1259
|
-
it("clears the runtime quota block when a lookup fails open", async () => {
|
|
1260
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1261
|
-
const worker = fakeWorker({ tokenId: 1, tokenName: "openai/haze" });
|
|
1262
|
-
addWorkers(dispatcher, [worker]);
|
|
1263
|
-
await dispatcher.onTokenUpdated(1, "openai/haze", credentials(), 80);
|
|
1264
|
-
readOpenAIQuotaUsageMock
|
|
1265
|
-
.mockResolvedValueOnce(quotaOk(85))
|
|
1266
|
-
.mockResolvedValueOnce(quotaFail("rpc timeout"))
|
|
1267
|
-
.mockResolvedValueOnce(quotaOk(85));
|
|
1268
|
-
|
|
1269
|
-
await expect(dispatcher.acquireIdleWorker()).rejects.toBeInstanceOf(
|
|
1270
|
-
QuotaThresholdExceededError,
|
|
1271
|
-
);
|
|
1272
|
-
const failOpenWorker = await dispatcher.acquireIdleWorker();
|
|
1273
|
-
failOpenWorker?.releaseTurn();
|
|
1274
|
-
await expect(dispatcher.acquireIdleWorker()).rejects.toBeInstanceOf(
|
|
1275
|
-
QuotaThresholdExceededError,
|
|
1276
|
-
);
|
|
1277
|
-
|
|
1278
|
-
const overThresholdLogs = loggerInfoMock.mock.calls.filter(([message]) =>
|
|
1279
|
-
String(message).includes("quota_threshold gate: over_threshold"),
|
|
1280
|
-
);
|
|
1281
|
-
expect(overThresholdLogs).toHaveLength(2);
|
|
1282
|
-
expect(loggerWarnMock).toHaveBeenCalledWith(
|
|
1283
|
-
expect.stringContaining("lookup_fail_open"),
|
|
1284
|
-
expect.objectContaining({ tokenId: 1, reason: "lookup_fail_open" }),
|
|
1285
|
-
);
|
|
1286
|
-
});
|
|
1287
|
-
|
|
1288
|
-
it("starts a new quota-block transition after the threshold changes", async () => {
|
|
1289
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1290
|
-
const worker = fakeWorker({ tokenId: 1, tokenName: "openai/haze" });
|
|
1291
|
-
addWorkers(dispatcher, [worker]);
|
|
1292
|
-
await dispatcher.onTokenUpdated(1, "openai/haze", credentials(), 80);
|
|
1293
|
-
readOpenAIQuotaUsageMock.mockResolvedValue(quotaOk(85));
|
|
1294
|
-
|
|
1295
|
-
await expect(dispatcher.acquireIdleWorker()).rejects.toBeInstanceOf(
|
|
1296
|
-
QuotaThresholdExceededError,
|
|
1297
|
-
);
|
|
1298
|
-
await dispatcher.onTokenUpdated(1, "openai/haze", credentials(), 70);
|
|
1299
|
-
await expect(dispatcher.acquireIdleWorker()).rejects.toBeInstanceOf(
|
|
1300
|
-
QuotaThresholdExceededError,
|
|
1301
|
-
);
|
|
1302
|
-
|
|
1303
|
-
const overThresholdLogs = loggerInfoMock.mock.calls.filter(([message]) =>
|
|
1304
|
-
String(message).includes("quota_threshold gate: over_threshold"),
|
|
1305
|
-
);
|
|
1306
|
-
expect(overThresholdLogs).toHaveLength(2);
|
|
1307
|
-
expect(overThresholdLogs[1]?.[0]).toBe(
|
|
1308
|
-
"quota_threshold gate: over_threshold openai/haze[1] (85% >= 70%)",
|
|
1309
|
-
);
|
|
1310
|
-
});
|
|
1311
|
-
|
|
1312
|
-
it("starts a new quota-block transition after deactivation and reactivation", async () => {
|
|
1313
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1314
|
-
const worker = fakeWorker({ tokenId: 1, tokenName: "openai/haze" });
|
|
1315
|
-
addWorkers(dispatcher, [worker]);
|
|
1316
|
-
await dispatcher.onTokenUpdated(1, "openai/haze", credentials(), 80);
|
|
1317
|
-
readOpenAIQuotaUsageMock.mockResolvedValue(quotaOk(85));
|
|
1318
|
-
|
|
1319
|
-
await expect(dispatcher.acquireIdleWorker()).rejects.toBeInstanceOf(
|
|
1320
|
-
QuotaThresholdExceededError,
|
|
1321
|
-
);
|
|
1322
|
-
dispatcher.onTokenDeactivated(1);
|
|
1323
|
-
dispatcher.onTokenActivated(1);
|
|
1324
|
-
await expect(dispatcher.acquireIdleWorker()).rejects.toBeInstanceOf(
|
|
1325
|
-
QuotaThresholdExceededError,
|
|
1326
|
-
);
|
|
1327
|
-
|
|
1328
|
-
const overThresholdLogs = loggerInfoMock.mock.calls.filter(([message]) =>
|
|
1329
|
-
String(message).includes("quota_threshold gate: over_threshold"),
|
|
1330
|
-
);
|
|
1331
|
-
expect(overThresholdLogs).toHaveLength(2);
|
|
1332
|
-
});
|
|
1333
|
-
|
|
1334
|
-
it("discards an over-threshold result when the threshold changes during lookup", async () => {
|
|
1335
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1336
|
-
const worker = fakeWorker({ tokenId: 1, tokenName: "openai/haze" });
|
|
1337
|
-
addWorkers(dispatcher, [worker]);
|
|
1338
|
-
await dispatcher.onTokenUpdated(1, "openai/haze", credentials(), 80);
|
|
1339
|
-
const pendingQuota = deferred<OpenAIQuotaUsageResult>();
|
|
1340
|
-
readOpenAIQuotaUsageMock
|
|
1341
|
-
.mockImplementationOnce(() => pendingQuota.promise)
|
|
1342
|
-
.mockResolvedValueOnce(quotaOk(85))
|
|
1343
|
-
.mockResolvedValueOnce(quotaOk(95));
|
|
1344
|
-
|
|
1345
|
-
const pendingAcquire = dispatcher.acquireIdleWorker();
|
|
1346
|
-
await vi.waitFor(() => expect(readOpenAIQuotaUsageMock).toHaveBeenCalledTimes(1));
|
|
1347
|
-
await dispatcher.onTokenUpdated(1, "openai/haze", credentials(), 90);
|
|
1348
|
-
pendingQuota.resolve(quotaOk(85));
|
|
1349
|
-
|
|
1350
|
-
const eligibleWorker = await pendingAcquire;
|
|
1351
|
-
expect(eligibleWorker).toBe(worker);
|
|
1352
|
-
eligibleWorker?.releaseTurn();
|
|
1353
|
-
await expect(dispatcher.acquireIdleWorker()).rejects.toBeInstanceOf(
|
|
1354
|
-
QuotaThresholdExceededError,
|
|
1355
|
-
);
|
|
1356
|
-
|
|
1357
|
-
const overThresholdLogs = loggerInfoMock.mock.calls.filter(([message]) =>
|
|
1358
|
-
String(message).includes("quota_threshold gate: over_threshold"),
|
|
1359
|
-
);
|
|
1360
|
-
expect(overThresholdLogs).toEqual([
|
|
1361
|
-
[
|
|
1362
|
-
"quota_threshold gate: over_threshold openai/haze[1] (95% >= 90%)",
|
|
1363
|
-
expect.objectContaining({
|
|
1364
|
-
tokenId: 1,
|
|
1365
|
-
threshold: 90,
|
|
1366
|
-
cachedUtilization: 95,
|
|
1367
|
-
}),
|
|
1368
|
-
],
|
|
1369
|
-
]);
|
|
1370
|
-
});
|
|
1371
|
-
|
|
1372
|
-
it("does not re-block autoscaling when the threshold is removed during lookup", async () => {
|
|
1373
|
-
const dispatcher = new OpenAIDispatcher(autoscaleConfig(), () => 64);
|
|
1374
|
-
const worker = fakeWorker({
|
|
1375
|
-
tokenId: 1,
|
|
1376
|
-
tokenName: "openai/haze",
|
|
1377
|
-
workerIndex: 0,
|
|
1378
|
-
});
|
|
1379
|
-
addWorkers(dispatcher, [worker]);
|
|
1380
|
-
await dispatcher.onTokenUpdated(1, "openai/haze", credentials(), 80);
|
|
1381
|
-
const pendingQuota = deferred<OpenAIQuotaUsageResult>();
|
|
1382
|
-
readOpenAIQuotaUsageMock.mockImplementationOnce(() => pendingQuota.promise);
|
|
1383
|
-
|
|
1384
|
-
const pendingAcquire = dispatcher.acquireIdleWorker();
|
|
1385
|
-
await vi.waitFor(() => expect(readOpenAIQuotaUsageMock).toHaveBeenCalledTimes(1));
|
|
1386
|
-
await dispatcher.onTokenUpdated(1, "openai/haze", credentials(), null);
|
|
1387
|
-
pendingQuota.resolve(quotaOk(85));
|
|
1388
|
-
|
|
1389
|
-
const eligibleWorker = await pendingAcquire;
|
|
1390
|
-
expect(eligibleWorker).toBe(worker);
|
|
1391
|
-
eligibleWorker?.releaseTurn();
|
|
1392
|
-
expect(
|
|
1393
|
-
loggerInfoMock.mock.calls.filter(([message]) =>
|
|
1394
|
-
String(message).includes("quota_threshold gate:"),
|
|
1395
|
-
),
|
|
1396
|
-
).toHaveLength(0);
|
|
1397
356
|
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
workerIndex: 1,
|
|
357
|
+
it("fails quota lookup open, gates all exceeded tokens, and recovers after lifecycle update", async () => {
|
|
358
|
+
const completeClient = () => ({
|
|
359
|
+
responses: () => events({ type: "completed", responseId: "r" }),
|
|
1402
360
|
});
|
|
1403
|
-
const
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
await dispatcher.scaleUpOneStep();
|
|
1407
|
-
|
|
1408
|
-
expect(spawnSingleWorker).toHaveBeenCalledTimes(1);
|
|
1409
|
-
expect(dispatcher.workerPool.get(1)).toEqual([worker, spawnedWorker]);
|
|
1410
|
-
});
|
|
1411
|
-
|
|
1412
|
-
it("does not restore a quota block when the token is deactivated during lookup", async () => {
|
|
1413
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1414
|
-
const worker = fakeWorker({ tokenId: 1, tokenName: "openai/haze" });
|
|
1415
|
-
addWorkers(dispatcher, [worker]);
|
|
1416
|
-
await dispatcher.onTokenUpdated(1, "openai/haze", credentials(), 80);
|
|
1417
|
-
const pendingQuota = deferred<OpenAIQuotaUsageResult>();
|
|
1418
|
-
readOpenAIQuotaUsageMock
|
|
1419
|
-
.mockImplementationOnce(() => pendingQuota.promise)
|
|
1420
|
-
.mockResolvedValueOnce(quotaOk(85));
|
|
1421
|
-
|
|
1422
|
-
const pendingAcquire = dispatcher.acquireIdleWorker();
|
|
1423
|
-
await vi.waitFor(() => expect(readOpenAIQuotaUsageMock).toHaveBeenCalledTimes(1));
|
|
1424
|
-
dispatcher.onTokenDeactivated(1);
|
|
1425
|
-
pendingQuota.resolve(quotaOk(85));
|
|
1426
|
-
|
|
1427
|
-
await expect(pendingAcquire).resolves.toBeNull();
|
|
1428
|
-
expect(
|
|
1429
|
-
loggerInfoMock.mock.calls.filter(([message]) =>
|
|
1430
|
-
String(message).includes("quota_threshold gate:"),
|
|
1431
|
-
),
|
|
1432
|
-
).toHaveLength(0);
|
|
1433
|
-
|
|
1434
|
-
dispatcher.onTokenActivated(1);
|
|
1435
|
-
await expect(dispatcher.acquireIdleWorker()).rejects.toBeInstanceOf(
|
|
1436
|
-
QuotaThresholdExceededError,
|
|
1437
|
-
);
|
|
1438
|
-
expect(
|
|
1439
|
-
loggerInfoMock.mock.calls.filter(([message]) =>
|
|
1440
|
-
String(message).includes("quota_threshold gate: over_threshold"),
|
|
1441
|
-
),
|
|
1442
|
-
).toHaveLength(1);
|
|
1443
|
-
});
|
|
1444
|
-
|
|
1445
|
-
it("keeps eligible busy workers queued instead of throwing quota errors", async () => {
|
|
1446
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1447
|
-
const worker = fakeWorker({ tokenId: 1, tokenName: "tok-A", busy: true });
|
|
1448
|
-
addWorkers(dispatcher, [worker]);
|
|
1449
|
-
await dispatcher.onTokenUpdated(1, "tok-A", credentials(), 80);
|
|
1450
|
-
readOpenAIQuotaUsageMock.mockResolvedValue(quotaOk(10));
|
|
1451
|
-
|
|
1452
|
-
await expect(dispatcher.acquireIdleWorker()).resolves.toBeNull();
|
|
1453
|
-
const queued = dispatcher.enqueue(async (w) => w.tokenName);
|
|
1454
|
-
await waitForQueue(dispatcher);
|
|
1455
|
-
|
|
1456
|
-
worker.releaseTurn();
|
|
1457
|
-
await dispatcher.drainQueue();
|
|
1458
|
-
await expect(queued).resolves.toBe("tok-A");
|
|
1459
|
-
});
|
|
1460
|
-
|
|
1461
|
-
it("throws typed error when no active ready tokenId passes threshold", async () => {
|
|
1462
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1463
|
-
addWorkers(dispatcher, [fakeWorker({ tokenId: 1, tokenName: "tok-A" })]);
|
|
1464
|
-
await dispatcher.onTokenUpdated(1, "tok-A", credentials(), 80);
|
|
1465
|
-
readOpenAIQuotaUsageMock.mockResolvedValueOnce(quotaOk(90));
|
|
1466
|
-
|
|
1467
|
-
const error = await dispatcher.acquireIdleWorker().catch((e) => e);
|
|
1468
|
-
|
|
1469
|
-
expect(error).toBeInstanceOf(QuotaThresholdExceededError);
|
|
1470
|
-
expect(error).toMatchObject({ code: "QUOTA_THRESHOLD_EXCEEDED" });
|
|
1471
|
-
expect(error.message).toBe(
|
|
1472
|
-
"All openai tokens exceeded quota threshold: tok-A (threshold 80%)",
|
|
1473
|
-
);
|
|
1474
|
-
});
|
|
1475
|
-
|
|
1476
|
-
it("rechecks threshold at drain time before assigning the released worker", async () => {
|
|
1477
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1478
|
-
const workerA = fakeWorker({ tokenId: 1, tokenName: "tok-A", busy: true });
|
|
1479
|
-
const workerB = fakeWorker({ tokenId: 2, tokenName: "tok-B", busy: true });
|
|
1480
|
-
addWorkers(dispatcher, [workerA, workerB]);
|
|
1481
|
-
await dispatcher.onTokenUpdated(1, "tok-A", credentials(), 80);
|
|
1482
|
-
await dispatcher.onTokenUpdated(2, "tok-B", credentials(), 80);
|
|
1483
|
-
const queued = dispatcher.enqueue(async (w) => w.tokenName);
|
|
1484
|
-
await waitForQueue(dispatcher);
|
|
1485
|
-
readOpenAIQuotaUsageMock.mockReset();
|
|
1486
|
-
readOpenAIQuotaUsageMock
|
|
1487
|
-
.mockResolvedValueOnce(quotaOk(90))
|
|
1488
|
-
.mockResolvedValueOnce(quotaOk(10));
|
|
1489
|
-
workerA.releaseTurn();
|
|
1490
|
-
workerB.releaseTurn();
|
|
1491
|
-
|
|
1492
|
-
await dispatcher.drainQueue();
|
|
1493
|
-
|
|
1494
|
-
await expect(queued).resolves.toBe("tok-B");
|
|
1495
|
-
});
|
|
1496
|
-
|
|
1497
|
-
it("serializes concurrent drain calls so a queue item is not assigned twice", async () => {
|
|
1498
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1499
|
-
const worker = fakeWorker({ tokenId: 1, tokenName: "tok-A", busy: true });
|
|
1500
|
-
addWorkers(dispatcher, [worker]);
|
|
1501
|
-
await dispatcher.onTokenUpdated(1, "tok-A", credentials(), null, 1);
|
|
1502
|
-
const execute = vi.fn(async (w: CodexAppServerWorker) => w.tokenName);
|
|
1503
|
-
const queued = dispatcher.enqueue(execute);
|
|
1504
|
-
await waitForQueue(dispatcher);
|
|
1505
|
-
worker.releaseTurn();
|
|
1506
|
-
|
|
1507
|
-
await Promise.all([dispatcher.drainQueue(), dispatcher.drainQueue()]);
|
|
1508
|
-
|
|
1509
|
-
await expect(queued).resolves.toBe("tok-A");
|
|
1510
|
-
expect(execute).toHaveBeenCalledTimes(1);
|
|
1511
|
-
});
|
|
1512
|
-
|
|
1513
|
-
it("treats quota lookup failure as fail-open", async () => {
|
|
1514
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1515
|
-
addWorkers(dispatcher, [fakeWorker({ tokenId: 1, tokenName: "tok-A" })]);
|
|
1516
|
-
await dispatcher.onTokenUpdated(1, "tok-A", credentials(), 80);
|
|
1517
|
-
readOpenAIQuotaUsageMock.mockResolvedValueOnce(quotaFail("rpc timeout"));
|
|
1518
|
-
|
|
1519
|
-
await expect(dispatcher.acquireIdleWorker()).resolves.toMatchObject({ tokenName: "tok-A" });
|
|
1520
|
-
expect(loggerWarnMock).toHaveBeenCalledWith(
|
|
1521
|
-
expect.stringContaining("lookup_fail_open"),
|
|
1522
|
-
expect.objectContaining({
|
|
1523
|
-
tokenId: 1,
|
|
1524
|
-
tokenName: "tok-A",
|
|
1525
|
-
provider: "openai",
|
|
1526
|
-
threshold: 80,
|
|
1527
|
-
reason: "lookup_fail_open",
|
|
1528
|
-
}),
|
|
1529
|
-
);
|
|
1530
|
-
});
|
|
1531
|
-
|
|
1532
|
-
it("falls back from over-threshold reuse to cold on another tokenId", async () => {
|
|
1533
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1534
|
-
const workerA = fakeWorker({ tokenId: 1, tokenName: "tok-A", threads: ["thread-1"] });
|
|
1535
|
-
const workerB = fakeWorker({ tokenId: 2, tokenName: "tok-B" });
|
|
1536
|
-
addWorkers(dispatcher, [workerA, workerB]);
|
|
1537
|
-
await dispatcher.onTokenUpdated(1, "tok-A", credentials(), 80);
|
|
1538
|
-
await dispatcher.onTokenUpdated(2, "tok-B", credentials(), 80);
|
|
1539
|
-
readOpenAIQuotaUsageMock.mockResolvedValueOnce(quotaOk(85)).mockResolvedValueOnce(quotaOk(10));
|
|
1540
|
-
const executeTurn = vi
|
|
1541
|
-
.spyOn(dispatcher, "executeTurn")
|
|
1542
|
-
.mockImplementation(async (worker, _req, reuseThreadId) =>
|
|
1543
|
-
resultFor(worker, reuseThreadId ?? "thread-new"),
|
|
1544
|
-
);
|
|
1545
|
-
|
|
1546
|
-
const result = await dispatcher.generate(
|
|
1547
|
-
baseReq({
|
|
1548
|
-
reuse: { workerId: makeOpenAIWorkerId(1, 0), threadId: "thread-1", epoch: 1 },
|
|
1549
|
-
}),
|
|
1550
|
-
);
|
|
1551
|
-
|
|
1552
|
-
expect(result.tokenName).toBe("tok-B");
|
|
1553
|
-
expect(executeTurn.mock.calls[0]?.[0]).toBe(workerB);
|
|
1554
|
-
expect(executeTurn.mock.calls[0]?.[2]).toBeUndefined();
|
|
1555
|
-
expect(workerA.tryAcquireTurn).not.toHaveBeenCalled();
|
|
1556
|
-
});
|
|
1557
|
-
|
|
1558
|
-
it("keeps reuse when the reused token is under threshold", async () => {
|
|
1559
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1560
|
-
const worker = fakeWorker({ tokenId: 1, tokenName: "tok-A", threads: ["thread-1"] });
|
|
1561
|
-
addWorkers(dispatcher, [worker]);
|
|
1562
|
-
await dispatcher.onTokenUpdated(1, "tok-A", credentials(), 80);
|
|
1563
|
-
readOpenAIQuotaUsageMock.mockResolvedValueOnce(quotaOk(10));
|
|
1564
|
-
const executeTurn = vi
|
|
1565
|
-
.spyOn(dispatcher, "executeTurn")
|
|
1566
|
-
.mockImplementation(async (selected, _req, reuseThreadId) =>
|
|
1567
|
-
resultFor(selected, reuseThreadId ?? "thread-new"),
|
|
1568
|
-
);
|
|
1569
|
-
|
|
1570
|
-
const result = await dispatcher.generate(
|
|
1571
|
-
baseReq({
|
|
1572
|
-
reuse: { workerId: makeOpenAIWorkerId(1, 0), threadId: "thread-1", epoch: 1 },
|
|
1573
|
-
}),
|
|
1574
|
-
);
|
|
1575
|
-
|
|
1576
|
-
expect(result.tokenName).toBe("tok-A");
|
|
1577
|
-
expect(executeTurn).toHaveBeenCalledWith(worker, expect.anything(), "thread-1");
|
|
1578
|
-
});
|
|
1579
|
-
|
|
1580
|
-
it("falls back from reuse when the token is deactivated during quota lookup", async () => {
|
|
1581
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1582
|
-
const workerA = fakeWorker({ tokenId: 1, tokenName: "tok-A", threads: ["thread-1"] });
|
|
1583
|
-
const workerB = fakeWorker({ tokenId: 2, tokenName: "tok-B" });
|
|
1584
|
-
addWorkers(dispatcher, [workerA, workerB]);
|
|
1585
|
-
await dispatcher.onTokenUpdated(1, "tok-A", credentials(), 80);
|
|
1586
|
-
await dispatcher.onTokenUpdated(2, "tok-B", credentials(), null);
|
|
1587
|
-
const pendingQuota = deferred<OpenAIQuotaUsageResult>();
|
|
1588
|
-
readOpenAIQuotaUsageMock.mockImplementationOnce(() => pendingQuota.promise);
|
|
1589
|
-
const executeTurn = vi
|
|
1590
|
-
.spyOn(dispatcher, "executeTurn")
|
|
1591
|
-
.mockImplementation(async (worker, _req, reuseThreadId) =>
|
|
1592
|
-
resultFor(worker, reuseThreadId ?? "thread-new"),
|
|
1593
|
-
);
|
|
1594
|
-
|
|
1595
|
-
const pendingGenerate = dispatcher.generate(
|
|
1596
|
-
baseReq({
|
|
1597
|
-
reuse: { workerId: makeOpenAIWorkerId(1, 0), threadId: "thread-1", epoch: 1 },
|
|
1598
|
-
}),
|
|
1599
|
-
);
|
|
1600
|
-
await vi.waitFor(() => expect(readOpenAIQuotaUsageMock).toHaveBeenCalledTimes(1));
|
|
1601
|
-
dispatcher.onTokenDeactivated(1);
|
|
1602
|
-
pendingQuota.resolve(quotaOk(10));
|
|
1603
|
-
|
|
1604
|
-
await expect(pendingGenerate).resolves.toMatchObject({ tokenName: "tok-B" });
|
|
1605
|
-
expect(workerA.tryAcquireTurn).not.toHaveBeenCalled();
|
|
1606
|
-
expect(executeTurn).toHaveBeenCalledWith(workerB, expect.anything());
|
|
1607
|
-
});
|
|
1608
|
-
|
|
1609
|
-
it("falls back from busy reuse when its quota metadata changes", async () => {
|
|
1610
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1611
|
-
const workerA = fakeWorker({
|
|
1612
|
-
tokenId: 1,
|
|
1613
|
-
tokenName: "tok-A",
|
|
1614
|
-
threads: ["thread-1"],
|
|
1615
|
-
busy: true,
|
|
361
|
+
const failOpen = new OpenAIDispatcher(config(), {
|
|
362
|
+
clientFactory: completeClient,
|
|
363
|
+
fetch: async () => new Response("down", { status: 503 }),
|
|
1616
364
|
});
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
reuse: { workerId: makeOpenAIWorkerId(1, 0), threadId: "thread-1", epoch: 1 },
|
|
1633
|
-
}),
|
|
1634
|
-
);
|
|
1635
|
-
await vi.waitFor(() => expect(workerA.tryAcquireTurn).toHaveBeenCalledTimes(1));
|
|
1636
|
-
await dispatcher.onTokenUpdated(1, "tok-A", credentials(), 5);
|
|
1637
|
-
|
|
1638
|
-
await expect(pendingGenerate).resolves.toMatchObject({ tokenName: "tok-B" });
|
|
1639
|
-
expect(executeTurn).toHaveBeenCalledWith(workerB, expect.anything());
|
|
1640
|
-
});
|
|
1641
|
-
|
|
1642
|
-
it("passes worker ttftMs into GenerateResult", async () => {
|
|
1643
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1644
|
-
const worker = fakeWorker({ tokenId: 1, tokenName: "tok-A" });
|
|
1645
|
-
const usage = {
|
|
1646
|
-
totalTokens: 12,
|
|
1647
|
-
inputTokens: 5,
|
|
1648
|
-
cachedInputTokens: 0,
|
|
1649
|
-
outputTokens: 7,
|
|
1650
|
-
reasoningOutputTokens: 0,
|
|
1651
|
-
};
|
|
1652
|
-
(
|
|
1653
|
-
worker as unknown as {
|
|
1654
|
-
executeTurn: () => Promise<{
|
|
1655
|
-
text: string;
|
|
1656
|
-
usage: typeof usage;
|
|
1657
|
-
durationMs: number;
|
|
1658
|
-
ttftMs: number | null;
|
|
1659
|
-
model: string;
|
|
1660
|
-
threadId: string;
|
|
1661
|
-
}>;
|
|
1662
|
-
}
|
|
1663
|
-
).executeTurn = vi.fn(async () => ({
|
|
1664
|
-
text: "ok",
|
|
1665
|
-
usage,
|
|
1666
|
-
durationMs: 80,
|
|
1667
|
-
ttftMs: 11,
|
|
1668
|
-
model: "gpt-5-codex",
|
|
1669
|
-
threadId: "thread-1",
|
|
1670
|
-
}));
|
|
1671
|
-
|
|
1672
|
-
const result = await dispatcher.executeTurn(worker, baseReq());
|
|
1673
|
-
|
|
1674
|
-
expect(result.ttftMs).toBe(11);
|
|
1675
|
-
expect(result.threadCoord?.threadId).toBe("thread-1");
|
|
1676
|
-
});
|
|
1677
|
-
|
|
1678
|
-
it("throws typed error when reuse is over threshold and no cold tokenId is eligible", async () => {
|
|
1679
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1680
|
-
const worker = fakeWorker({ tokenId: 1, tokenName: "tok-A", threads: ["thread-1"] });
|
|
1681
|
-
addWorkers(dispatcher, [worker]);
|
|
1682
|
-
await dispatcher.onTokenUpdated(1, "tok-A", credentials(), 80);
|
|
1683
|
-
readOpenAIQuotaUsageMock.mockResolvedValueOnce(quotaOk(85));
|
|
1684
|
-
|
|
1685
|
-
await expect(
|
|
1686
|
-
dispatcher.generate(
|
|
1687
|
-
baseReq({
|
|
1688
|
-
reuse: { workerId: makeOpenAIWorkerId(1, 0), threadId: "thread-1", epoch: 1 },
|
|
1689
|
-
}),
|
|
1690
|
-
),
|
|
1691
|
-
).rejects.toBeInstanceOf(QuotaThresholdExceededError);
|
|
1692
|
-
});
|
|
1693
|
-
});
|
|
1694
|
-
|
|
1695
|
-
describe("OpenAIDispatcher image generation gate and failure classification", () => {
|
|
1696
|
-
it("throws a gate error without running the turn when capability is unsupported", async () => {
|
|
1697
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1698
|
-
const worker = fakeWorker({ imageGateReason: "provider does not support image generation" });
|
|
1699
|
-
|
|
1700
|
-
await expect(
|
|
1701
|
-
dispatcher.executeTurn(worker, baseReq({ imageGeneration: true })),
|
|
1702
|
-
).rejects.toMatchObject({ kind: "gate" });
|
|
1703
|
-
// 게이트 실패 시 turn 은 실행되지 않는다.
|
|
1704
|
-
expect((worker as unknown as { executeTurn: ReturnType<typeof vi.fn> }).executeTurn).not.toHaveBeenCalled();
|
|
1705
|
-
});
|
|
1706
|
-
|
|
1707
|
-
it("throws a gate error for a non-multimodal model", async () => {
|
|
1708
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1709
|
-
const worker = fakeWorker({ imageGateReason: "model gpt-x is not multimodal (no image input modality)" });
|
|
1710
|
-
|
|
1711
|
-
await expect(
|
|
1712
|
-
dispatcher.executeTurn(worker, baseReq({ imageGeneration: true, model: "gpt-x" })),
|
|
1713
|
-
).rejects.toBeInstanceOf(ImageGenerationError);
|
|
1714
|
-
});
|
|
1715
|
-
|
|
1716
|
-
it("classifies zero images with no tool call as not_called (retry futile)", async () => {
|
|
1717
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1718
|
-
const worker = fakeWorker({ imageGateReason: null, imageTurnResult: { imageAttempted: false } });
|
|
1719
|
-
|
|
1720
|
-
await expect(
|
|
1721
|
-
dispatcher.executeTurn(worker, baseReq({ imageGeneration: true })),
|
|
1722
|
-
).rejects.toMatchObject({ kind: "not_called" });
|
|
1723
|
-
});
|
|
1724
|
-
|
|
1725
|
-
it("classifies zero images after an attempt as incomplete (retry candidate)", async () => {
|
|
1726
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1727
|
-
const worker = fakeWorker({ imageGateReason: null, imageTurnResult: { imageAttempted: true } });
|
|
1728
|
-
|
|
1729
|
-
await expect(
|
|
1730
|
-
dispatcher.executeTurn(worker, baseReq({ imageGeneration: true })),
|
|
1731
|
-
).rejects.toMatchObject({ kind: "incomplete" });
|
|
1732
|
-
});
|
|
1733
|
-
|
|
1734
|
-
it("passes an image result through without gating a valid request", async () => {
|
|
1735
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1736
|
-
const worker = fakeWorker({
|
|
1737
|
-
imageGateReason: null,
|
|
1738
|
-
imageTurnResult: { images: [{ data: "iVBORw0KGgoBAgM", revisedPrompt: "a cat" }], imageAttempted: true },
|
|
365
|
+
await failOpen.onTokenAdded(1, "one", credentials, 80);
|
|
366
|
+
await expect(failOpen.generate(request())).resolves.toMatchObject({ tokenName: "one" });
|
|
367
|
+
|
|
368
|
+
const blocked = new OpenAIDispatcher(config(), {
|
|
369
|
+
clientFactory: completeClient,
|
|
370
|
+
fetch: async () =>
|
|
371
|
+
new Response(
|
|
372
|
+
JSON.stringify({
|
|
373
|
+
rate_limits: {
|
|
374
|
+
limit_id: "codex",
|
|
375
|
+
primary_window: { used_percent: 90, window_minutes: 300, reset_at: 123 },
|
|
376
|
+
},
|
|
377
|
+
}),
|
|
378
|
+
{ status: 200, headers: { "content-type": "application/json" } },
|
|
379
|
+
),
|
|
1739
380
|
});
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
expect(
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
it("does not gate or classify a normal text request", async () => {
|
|
1747
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1748
|
-
const worker = fakeWorker({ imageTurnResult: {} });
|
|
1749
|
-
|
|
1750
|
-
const result = await dispatcher.executeTurn(worker, baseReq());
|
|
1751
|
-
expect(result.text).toBe("ok");
|
|
1752
|
-
expect((worker as unknown as { checkImageGenerationSupport: ReturnType<typeof vi.fn> }).checkImageGenerationSupport).not.toHaveBeenCalled();
|
|
1753
|
-
});
|
|
1754
|
-
});
|
|
1755
|
-
|
|
1756
|
-
describe("OpenAIDispatcher image generation routing", () => {
|
|
1757
|
-
it("rejects image requests on the streaming path", async () => {
|
|
1758
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1759
|
-
const cb = { onDelta: vi.fn(), onComplete: vi.fn(), onError: vi.fn() };
|
|
1760
|
-
await expect(
|
|
1761
|
-
dispatcher.generateStream(baseReq({ imageGeneration: true }), cb),
|
|
1762
|
-
).rejects.toBeInstanceOf(ImageGenerationError);
|
|
1763
|
-
});
|
|
1764
|
-
|
|
1765
|
-
it("forces cold thread for image requests even when a reuse coordinate is present", async () => {
|
|
1766
|
-
const dispatcher = new OpenAIDispatcher();
|
|
1767
|
-
const worker = await dispatcher.acquireReuseWorker(
|
|
1768
|
-
baseReq({
|
|
1769
|
-
imageGeneration: true,
|
|
1770
|
-
reuse: { workerId: makeOpenAIWorkerId(1, 0), threadId: "t1", epoch: 1 },
|
|
1771
|
-
}),
|
|
1772
|
-
);
|
|
1773
|
-
expect(worker).toBeNull();
|
|
381
|
+
await blocked.onTokenAdded(1, "one", credentials, 80);
|
|
382
|
+
await expect(blocked.generate(request())).rejects.toBeInstanceOf(Error);
|
|
383
|
+
await blocked.onTokenUpdated(1, "one", credentials, null, 1);
|
|
384
|
+
await expect(blocked.generate(request())).resolves.toMatchObject({ tokenName: "one" });
|
|
385
|
+
blocked.onTokenDeactivated(1);
|
|
386
|
+
await expect(blocked.generate(request())).rejects.toThrow("NO_OPENAI_WORKERS");
|
|
1774
387
|
});
|
|
1775
388
|
});
|