@mupt-ai/dari-gateway 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -4
- package/dist/bun.d.ts +2 -0
- package/dist/bun.js +4 -0
- package/dist/context/eval_catalog.d.ts +3 -0
- package/dist/context/eval_catalog.js +7 -0
- package/dist/context/interaction_fingerprint.d.ts +27 -0
- package/dist/context/interaction_fingerprint.js +519 -0
- package/dist/context/interaction_fingerprint_format.d.ts +42 -0
- package/dist/context/interaction_fingerprint_format.js +113 -0
- package/dist/context/interaction_lease_depth.d.ts +2 -0
- package/dist/context/interaction_lease_depth.js +110 -0
- package/dist/context/lease_history.d.ts +7 -0
- package/dist/context/lease_history.js +158 -0
- package/dist/context/pricing.d.ts +4 -0
- package/dist/context/pricing.js +27 -0
- package/dist/context/provider_prompt_accounting.d.ts +14 -0
- package/dist/context/provider_prompt_accounting.js +187 -0
- package/dist/context/routing_context.d.ts +40 -0
- package/dist/context/routing_context.js +211 -0
- package/dist/http/auth.d.ts +2 -0
- package/dist/http/auth.js +35 -0
- package/dist/http/errors.d.ts +19 -0
- package/dist/http/errors.js +89 -0
- package/dist/http/handler.d.ts +12 -0
- package/dist/http/handler.js +88 -0
- package/dist/http/http2_server.d.ts +6 -0
- package/dist/http/http2_server.js +103 -0
- package/dist/http/serve.d.ts +20 -0
- package/dist/http/serve.js +78 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +9 -0
- package/dist/ingress/anthropic_messages.d.ts +3 -0
- package/dist/ingress/anthropic_messages.js +122 -0
- package/dist/ingress/anthropic_models.d.ts +1 -0
- package/dist/ingress/anthropic_models.js +23 -0
- package/dist/ingress/chat_completions.d.ts +2 -0
- package/dist/ingress/chat_completions.js +44 -0
- package/dist/ingress/claude_code/request_context.d.ts +2 -0
- package/dist/ingress/claude_code/request_context.js +31 -0
- package/dist/ingress/codex.d.ts +3 -0
- package/dist/ingress/codex.js +69 -0
- package/dist/ingress/codex_models.d.ts +2 -0
- package/dist/ingress/codex_models.js +89 -0
- package/dist/ingress/json.d.ts +1 -0
- package/dist/ingress/json.js +95 -0
- package/dist/ingress/models.d.ts +1 -0
- package/dist/ingress/models.js +65 -0
- package/dist/ingress/muse_code.d.ts +2 -0
- package/dist/ingress/muse_code.js +8 -0
- package/dist/ingress/muse_models.d.ts +9 -0
- package/dist/ingress/muse_models.js +32 -0
- package/dist/interaction/capabilities.d.ts +3 -0
- package/dist/interaction/capabilities.js +24 -0
- package/dist/interaction/image.d.ts +4 -0
- package/dist/interaction/image.js +13 -0
- package/dist/interaction/portable_reasoning_state.d.ts +4 -0
- package/dist/interaction/portable_reasoning_state.js +18 -0
- package/dist/interaction/provider_continuation_state.d.ts +6 -0
- package/dist/interaction/provider_continuation_state.js +27 -0
- package/dist/interaction/tool_identity.d.ts +10 -0
- package/dist/interaction/tool_identity.js +41 -0
- package/dist/interaction/types.d.ts +204 -0
- package/dist/interaction/types.js +5 -0
- package/dist/models/catalog.d.ts +35 -0
- package/dist/models/catalog.js +232 -0
- package/dist/models/context_limits.d.ts +2 -0
- package/dist/models/context_limits.js +7 -0
- package/dist/models/execution_provider.d.ts +9 -0
- package/dist/models/execution_provider.js +17 -0
- package/dist/models/gateways.d.ts +11 -0
- package/dist/models/gateways.js +45 -0
- package/dist/models/ids.d.ts +1 -0
- package/dist/models/ids.js +15 -0
- package/dist/models/provider_defaults.d.ts +4 -0
- package/dist/models/provider_defaults.js +44 -0
- package/dist/models/runtime_overrides.d.ts +7 -0
- package/dist/models/runtime_overrides.js +226 -0
- package/dist/models/subscriptions.d.ts +8 -0
- package/dist/models/subscriptions.js +37 -0
- package/dist/observability/errors.d.ts +8 -0
- package/dist/observability/errors.js +11 -0
- package/dist/platform/platform.d.ts +156 -0
- package/dist/platform/platform.js +11 -0
- package/dist/platform/routing_contract.d.ts +2 -0
- package/dist/platform/routing_contract.js +5 -0
- package/dist/protocol/input/anthropic_messages.d.ts +2 -0
- package/dist/protocol/input/anthropic_messages.js +494 -0
- package/dist/protocol/input/chat_completions.d.ts +4 -0
- package/dist/protocol/input/chat_completions.js +214 -0
- package/dist/protocol/input/chat_completions_validation.d.ts +2 -0
- package/dist/protocol/input/chat_completions_validation.js +258 -0
- package/dist/protocol/input/openai_responses.d.ts +2 -0
- package/dist/protocol/input/openai_responses.js +666 -0
- package/dist/protocol/input/router_model.d.ts +7 -0
- package/dist/protocol/input/router_model.js +43 -0
- package/dist/protocol/output/anthropic_messages.d.ts +10 -0
- package/dist/protocol/output/anthropic_messages.js +15 -0
- package/dist/protocol/output/anthropic_messages_output.d.ts +10 -0
- package/dist/protocol/output/anthropic_messages_output.js +124 -0
- package/dist/protocol/output/anthropic_messages_stream.d.ts +16 -0
- package/dist/protocol/output/anthropic_messages_stream.js +267 -0
- package/dist/protocol/output/chat_completions.d.ts +29 -0
- package/dist/protocol/output/chat_completions.js +406 -0
- package/dist/protocol/output/chat_reasoning_detail.d.ts +2 -0
- package/dist/protocol/output/chat_reasoning_detail.js +13 -0
- package/dist/protocol/output/delivered_stream_snapshot.d.ts +10 -0
- package/dist/protocol/output/delivered_stream_snapshot.js +31 -0
- package/dist/protocol/output/openai_responses.d.ts +10 -0
- package/dist/protocol/output/openai_responses.js +14 -0
- package/dist/protocol/output/openai_responses_output.d.ts +14 -0
- package/dist/protocol/output/openai_responses_output.js +125 -0
- package/dist/protocol/output/openai_responses_stream.d.ts +18 -0
- package/dist/protocol/output/openai_responses_stream.js +546 -0
- package/dist/protocol/output/sse_stream.d.ts +31 -0
- package/dist/protocol/output/sse_stream.js +67 -0
- package/dist/providers/anthropic_safeguards.d.ts +11 -0
- package/dist/providers/anthropic_safeguards.js +81 -0
- package/dist/providers/aws_assume_role.d.ts +17 -0
- package/dist/providers/aws_assume_role.js +107 -0
- package/dist/providers/cancel_estimate.d.ts +43 -0
- package/dist/providers/cancel_estimate.js +89 -0
- package/dist/providers/execution.d.ts +72 -0
- package/dist/providers/execution.js +491 -0
- package/dist/providers/model_capabilities.d.ts +11 -0
- package/dist/providers/model_capabilities.js +29 -0
- package/dist/providers/pi.d.ts +65 -0
- package/dist/providers/pi.js +325 -0
- package/dist/providers/pi_context.d.ts +7 -0
- package/dist/providers/pi_context.js +405 -0
- package/dist/providers/pi_options.d.ts +11 -0
- package/dist/providers/pi_options.js +410 -0
- package/dist/providers/pi_output.d.ts +2 -0
- package/dist/providers/pi_output.js +453 -0
- package/dist/providers/provider_attempt_runner.d.ts +55 -0
- package/dist/providers/provider_attempt_runner.js +90 -0
- package/dist/providers/provider_call.d.ts +77 -0
- package/dist/providers/provider_call.js +296 -0
- package/dist/providers/provider_reported_cost.d.ts +10 -0
- package/dist/providers/provider_reported_cost.js +123 -0
- package/dist/providers/reasoning.d.ts +12 -0
- package/dist/providers/reasoning.js +30 -0
- package/dist/providers/response_capture.d.ts +23 -0
- package/dist/providers/response_capture.js +47 -0
- package/dist/providers/stream_finalization.d.ts +46 -0
- package/dist/providers/stream_finalization.js +165 -0
- package/dist/providers/subscription_limits.d.ts +33 -0
- package/dist/providers/subscription_limits.js +179 -0
- package/dist/providers/subscription_usage.d.ts +10 -0
- package/dist/providers/subscription_usage.js +79 -0
- package/dist/runtime/claude_code/auxiliary_routing.d.ts +3 -0
- package/dist/runtime/claude_code/auxiliary_routing.js +60 -0
- package/dist/runtime/customer_disconnect.d.ts +20 -0
- package/dist/runtime/customer_disconnect.js +49 -0
- package/dist/runtime/explicit_model.d.ts +7 -0
- package/dist/runtime/explicit_model.js +57 -0
- package/dist/runtime/harness_identity/conversation.d.ts +33 -0
- package/dist/runtime/harness_identity/conversation.js +39 -0
- package/dist/runtime/harness_identity/extract.d.ts +8 -0
- package/dist/runtime/harness_identity/extract.js +214 -0
- package/dist/runtime/harness_identity/index.d.ts +2 -0
- package/dist/runtime/harness_identity/index.js +2 -0
- package/dist/runtime/prepare_routed_completion.d.ts +33 -0
- package/dist/runtime/prepare_routed_completion.js +186 -0
- package/dist/runtime/provider_stream_lifecycle.d.ts +31 -0
- package/dist/runtime/provider_stream_lifecycle.js +88 -0
- package/dist/runtime/provider_stream_outcome.d.ts +23 -0
- package/dist/runtime/provider_stream_outcome.js +55 -0
- package/dist/runtime/request_tags.d.ts +7 -0
- package/dist/runtime/request_tags.js +33 -0
- package/dist/runtime/routed_completion.d.ts +17 -0
- package/dist/runtime/routed_completion.js +80 -0
- package/dist/runtime/routed_protocol.d.ts +30 -0
- package/dist/runtime/routed_protocol.js +1 -0
- package/dist/runtime/routed_runtime.d.ts +40 -0
- package/dist/runtime/routed_runtime.js +535 -0
- package/dist/runtime/routing_lease.d.ts +26 -0
- package/dist/runtime/routing_lease.js +210 -0
- package/dist/runtime/runtime_reporter.d.ts +71 -0
- package/dist/runtime/runtime_reporter.js +35 -0
- package/dist/runtime/strict_provider_access.d.ts +6 -0
- package/dist/runtime/strict_provider_access.js +40 -0
- package/dist/self_host/config.d.ts +46 -0
- package/dist/self_host/config.js +105 -0
- package/dist/self_host/main.d.ts +16 -0
- package/dist/self_host/main.js +95 -0
- package/dist/self_host/platform.d.ts +13 -0
- package/dist/self_host/platform.js +50 -0
- package/dist/self_host/prefix_store.d.ts +46 -0
- package/dist/self_host/prefix_store.js +261 -0
- package/dist/self_host/resolve.d.ts +28 -0
- package/dist/self_host/resolve.js +167 -0
- package/dist/self_host/subscriptions/access.d.ts +10 -0
- package/dist/self_host/subscriptions/access.js +37 -0
- package/dist/self_host/subscriptions/http.d.ts +15 -0
- package/dist/self_host/subscriptions/http.js +187 -0
- package/dist/self_host/subscriptions/index.d.ts +24 -0
- package/dist/self_host/subscriptions/index.js +24 -0
- package/dist/self_host/subscriptions/oauth.d.ts +59 -0
- package/dist/self_host/subscriptions/oauth.js +376 -0
- package/dist/self_host/subscriptions/store.d.ts +78 -0
- package/dist/self_host/subscriptions/store.js +236 -0
- package/dist/strategies/auto_routing_selector.d.ts +12 -0
- package/dist/strategies/auto_routing_selector.js +61 -0
- package/dist/strategies/eval_relevance.d.ts +17 -0
- package/dist/strategies/eval_relevance.js +32 -0
- package/dist/strategies/fallback_decision.d.ts +8 -0
- package/dist/strategies/fallback_decision.js +17 -0
- package/dist/strategies/priority_selector.d.ts +7 -0
- package/dist/strategies/priority_selector.js +37 -0
- package/dist/strategies/route_decision.d.ts +22 -0
- package/dist/strategies/route_decision.js +65 -0
- package/dist/strategies/routing.d.ts +74 -0
- package/dist/strategies/routing.js +280 -0
- package/dist/strategies/selector_projection.d.ts +15 -0
- package/dist/strategies/selector_projection.js +161 -0
- package/dist/telemetry/background.d.ts +7 -0
- package/dist/telemetry/background.js +33 -0
- package/dist/telemetry/benchmark_replay.d.ts +37 -0
- package/dist/telemetry/benchmark_replay.js +108 -0
- package/dist/telemetry/billing_finalization.d.ts +64 -0
- package/dist/telemetry/billing_finalization.js +96 -0
- package/dist/telemetry/ingest_values.d.ts +4 -0
- package/dist/telemetry/ingest_values.js +12 -0
- package/dist/telemetry/model_cost.d.ts +3 -0
- package/dist/telemetry/model_cost.js +15 -0
- package/dist/telemetry/prefix_state.d.ts +47 -0
- package/dist/telemetry/prefix_state.js +116 -0
- package/dist/telemetry/report.d.ts +88 -0
- package/dist/telemetry/report.js +621 -0
- package/dist/telemetry/requests/interaction_observability.d.ts +45 -0
- package/dist/telemetry/requests/interaction_observability.js +180 -0
- package/dist/telemetry/requests/retained_interaction_request.d.ts +8 -0
- package/dist/telemetry/requests/retained_interaction_request.js +10 -0
- package/dist/telemetry/scrub.d.ts +2 -0
- package/dist/telemetry/scrub.js +31 -0
- package/dist/telemetry/skills/claude/catalog.d.ts +6 -0
- package/dist/telemetry/skills/claude/catalog.js +99 -0
- package/dist/telemetry/skills/claude/file_reads.d.ts +4 -0
- package/dist/telemetry/skills/claude/file_reads.js +110 -0
- package/dist/telemetry/skills/claude/observations.d.ts +3 -0
- package/dist/telemetry/skills/claude/observations.js +366 -0
- package/dist/telemetry/skills/codex/catalog.d.ts +11 -0
- package/dist/telemetry/skills/codex/catalog.js +138 -0
- package/dist/telemetry/skills/codex/exec_file_reads.d.ts +9 -0
- package/dist/telemetry/skills/codex/exec_file_reads.js +36 -0
- package/dist/telemetry/skills/codex/explicit.d.ts +3 -0
- package/dist/telemetry/skills/codex/explicit.js +90 -0
- package/dist/telemetry/skills/codex/file_reads.d.ts +4 -0
- package/dist/telemetry/skills/codex/file_reads.js +37 -0
- package/dist/telemetry/skills/codex/identity.d.ts +2 -0
- package/dist/telemetry/skills/codex/identity.js +20 -0
- package/dist/telemetry/skills/observations.d.ts +21 -0
- package/dist/telemetry/skills/observations.js +41 -0
- package/dist/telemetry/skills/paths.d.ts +11 -0
- package/dist/telemetry/skills/paths.js +61 -0
- package/dist/telemetry/skills/pi.d.ts +6 -0
- package/dist/telemetry/skills/pi.js +223 -0
- package/dist/telemetry/skills/shell_file_reads.d.ts +7 -0
- package/dist/telemetry/skills/shell_file_reads.js +226 -0
- package/dist/telemetry/skills/shell_words.d.ts +13 -0
- package/dist/telemetry/skills/shell_words.js +189 -0
- package/dist/telemetry/tools/input.d.ts +2 -0
- package/dist/telemetry/tools/input.js +14 -0
- package/dist/telemetry/tools/observations.d.ts +29 -0
- package/dist/telemetry/tools/observations.js +247 -0
- package/dist/telemetry/usage.d.ts +57 -0
- package/dist/telemetry/usage.js +136 -0
- package/dist/types.d.ts +97 -0
- package/dist/types.js +1 -0
- package/package.json +22 -7
- package/src/bun.ts +2 -2
- package/src/context/eval_catalog.ts +1 -1
- package/src/context/interaction_fingerprint.ts +9 -9
- package/src/context/interaction_fingerprint_format.ts +1 -1
- package/src/context/interaction_lease_depth.ts +1 -1
- package/src/context/pricing.ts +6 -3
- package/src/context/provider_prompt_accounting.ts +5 -5
- package/src/context/routing_context.ts +16 -16
- package/src/http/auth.ts +1 -1
- package/src/http/handler.ts +15 -8
- package/src/http/serve.ts +3 -3
- package/src/index.ts +14 -6
- package/src/ingress/anthropic_messages.ts +12 -12
- package/src/ingress/anthropic_models.ts +1 -1
- package/src/ingress/chat_completions.ts +17 -10
- package/src/ingress/claude_code/request_context.ts +2 -2
- package/src/ingress/codex.ts +14 -10
- package/src/ingress/codex_models.ts +4 -4
- package/src/ingress/json.ts +1 -1
- package/src/ingress/models.ts +22 -10
- package/src/ingress/muse_code.ts +9 -0
- package/src/ingress/muse_models.ts +36 -0
- package/src/interaction/capabilities.ts +1 -1
- package/src/interaction/portable_reasoning_state.ts +1 -1
- package/src/interaction/provider_continuation_state.ts +1 -1
- package/src/interaction/tool_identity.ts +2 -2
- package/src/interaction/types.ts +2 -0
- package/src/models/catalog.ts +310 -0
- package/src/models/context_limits.ts +1 -1
- package/src/models/execution_provider.ts +5 -2
- package/src/models/ids.ts +1 -1
- package/src/models/provider_defaults.ts +4 -1
- package/src/models/runtime_overrides.ts +23 -1
- package/src/models/subscriptions.ts +54 -0
- package/src/observability/errors.ts +2 -2
- package/src/platform/platform.ts +9 -5
- package/src/protocol/input/anthropic_messages.ts +7 -7
- package/src/protocol/input/chat_completions.ts +8 -6
- package/src/protocol/input/chat_completions_validation.ts +6 -5
- package/src/protocol/input/openai_responses.ts +6 -6
- package/src/protocol/output/anthropic_messages.ts +3 -3
- package/src/protocol/output/anthropic_messages_output.ts +6 -4
- package/src/protocol/output/anthropic_messages_stream.ts +7 -7
- package/src/protocol/output/chat_completions.ts +13 -13
- package/src/protocol/output/chat_reasoning_detail.ts +1 -1
- package/src/protocol/output/openai_responses.ts +3 -3
- package/src/protocol/output/openai_responses_output.ts +4 -2
- package/src/protocol/output/openai_responses_stream.ts +6 -6
- package/src/protocol/output/sse_stream.ts +3 -3
- package/src/providers/anthropic_safeguards.ts +2 -2
- package/src/providers/aws_assume_role.ts +2 -2
- package/src/providers/cancel_estimate.ts +1 -1
- package/src/providers/execution.ts +17 -17
- package/src/providers/pi.ts +34 -19
- package/src/providers/pi_context.ts +6 -6
- package/src/providers/pi_options.ts +27 -11
- package/src/providers/pi_output.ts +5 -5
- package/src/providers/provider_attempt_runner.ts +1 -1
- package/src/providers/provider_call.ts +21 -17
- package/src/providers/provider_reported_cost.ts +3 -3
- package/src/providers/reasoning.ts +2 -2
- package/src/providers/stream_finalization.ts +9 -9
- package/src/providers/subscription_limits.ts +24 -7
- package/src/runtime/claude_code/auxiliary_routing.ts +5 -5
- package/src/runtime/customer_disconnect.ts +1 -1
- package/src/runtime/explicit_model.ts +19 -20
- package/src/runtime/harness_identity/conversation.ts +1 -1
- package/src/runtime/harness_identity/extract.ts +3 -3
- package/src/runtime/harness_identity/index.ts +2 -2
- package/src/runtime/prepare_routed_completion.ts +35 -16
- package/src/runtime/provider_stream_lifecycle.ts +1 -1
- package/src/runtime/provider_stream_outcome.ts +2 -2
- package/src/runtime/request_tags.ts +2 -2
- package/src/runtime/routed_completion.ts +11 -11
- package/src/runtime/routed_protocol.ts +2 -2
- package/src/runtime/routed_runtime.ts +20 -19
- package/src/runtime/routing_lease.ts +7 -7
- package/src/runtime/runtime_reporter.ts +3 -3
- package/src/runtime/strict_provider_access.ts +42 -0
- package/src/self_host/main.ts +12 -12
- package/src/self_host/platform.ts +5 -5
- package/src/self_host/prefix_store.ts +2 -2
- package/src/self_host/resolve.ts +17 -31
- package/src/self_host/subscriptions/access.ts +2 -2
- package/src/self_host/subscriptions/http.ts +2 -2
- package/src/self_host/subscriptions/index.ts +4 -4
- package/src/self_host/subscriptions/oauth.ts +139 -8
- package/src/self_host/subscriptions/store.ts +2 -1
- package/src/strategies/auto_routing_selector.ts +2 -2
- package/src/strategies/eval_relevance.ts +3 -3
- package/src/strategies/priority_selector.ts +1 -1
- package/src/strategies/route_decision.ts +7 -7
- package/src/strategies/routing.ts +10 -10
- package/src/strategies/selector_projection.ts +2 -2
- package/src/telemetry/billing_finalization.ts +3 -3
- package/src/telemetry/model_cost.ts +1 -1
- package/src/telemetry/prefix_state.ts +4 -4
- package/src/telemetry/report.ts +21 -21
- package/src/telemetry/requests/interaction_observability.ts +1 -1
- package/src/telemetry/requests/retained_interaction_request.ts +1 -1
- package/src/telemetry/skills/claude/catalog.ts +1 -1
- package/src/telemetry/skills/claude/file_reads.ts +6 -6
- package/src/telemetry/skills/claude/observations.ts +3 -3
- package/src/telemetry/skills/codex/catalog.ts +3 -3
- package/src/telemetry/skills/codex/exec_file_reads.ts +4 -4
- package/src/telemetry/skills/codex/explicit.ts +3 -3
- package/src/telemetry/skills/codex/file_reads.ts +5 -5
- package/src/telemetry/skills/observations.ts +7 -7
- package/src/telemetry/skills/pi.ts +3 -3
- package/src/telemetry/skills/shell_file_reads.ts +2 -2
- package/src/telemetry/skills/shell_words.ts +1 -1
- package/src/telemetry/tools/input.ts +1 -1
- package/src/telemetry/tools/observations.ts +9 -9
- package/src/telemetry/usage.ts +5 -5
- package/src/types.ts +20 -3
|
@@ -5,13 +5,13 @@ import type {
|
|
|
5
5
|
StrategyCandidateResolution,
|
|
6
6
|
SelectorLeaseHistoryEntry,
|
|
7
7
|
} from "@mupt-ai/dari-router/policy-engine";
|
|
8
|
-
import { publicCatalogSelectorEvals } from "../context/eval_catalog";
|
|
9
|
-
import { HttpError } from "../http/errors";
|
|
10
|
-
import { relevantEvals } from "./eval_relevance";
|
|
11
|
-
import { executionProviderForModel } from "../models/execution_provider";
|
|
12
|
-
import { selectModel, type SelectorBackend, type SelectorRun } from "./routing";
|
|
13
|
-
import type { SelectorImage } from "./selector_projection";
|
|
14
|
-
import type { ResolvedRouter } from "../types";
|
|
8
|
+
import { publicCatalogSelectorEvals } from "../context/eval_catalog.js";
|
|
9
|
+
import { HttpError } from "../http/errors.js";
|
|
10
|
+
import { relevantEvals } from "./eval_relevance.js";
|
|
11
|
+
import { executionProviderForModel } from "../models/execution_provider.js";
|
|
12
|
+
import { selectModel, type SelectorBackend, type SelectorRun } from "./routing.js";
|
|
13
|
+
import type { SelectorImage } from "./selector_projection.js";
|
|
14
|
+
import type { ResolvedRouter } from "../types.js";
|
|
15
15
|
|
|
16
16
|
export type RoutedDecision = {
|
|
17
17
|
decision: RoutingDecision;
|
|
@@ -21,21 +21,21 @@ import {
|
|
|
21
21
|
type SelectorInput,
|
|
22
22
|
type SelectorLeaseHistoryEntry,
|
|
23
23
|
} from "@mupt-ai/dari-router/policy-engine";
|
|
24
|
-
import { HttpError } from "../http/errors";
|
|
25
|
-
import { executionProviderForModel } from "../models/execution_provider";
|
|
26
|
-
import { providerLabel } from "../models/provider_defaults";
|
|
27
|
-
import { internalChatCompletionsToInteraction } from "../protocol/input/chat_completions";
|
|
28
|
-
import { gatewayPlatform, type ResolveRouterRequest } from "../platform/platform";
|
|
29
|
-
import { isBedrockApi } from "../providers/model_capabilities";
|
|
30
|
-
import { completeInteractionModel, modelContextWindow } from "../providers/pi";
|
|
24
|
+
import { HttpError } from "../http/errors.js";
|
|
25
|
+
import { executionProviderForModel } from "../models/execution_provider.js";
|
|
26
|
+
import { providerLabel } from "../models/provider_defaults.js";
|
|
27
|
+
import { internalChatCompletionsToInteraction } from "../protocol/input/chat_completions.js";
|
|
28
|
+
import { gatewayPlatform, type ResolveRouterRequest } from "../platform/platform.js";
|
|
29
|
+
import { isBedrockApi } from "../providers/model_capabilities.js";
|
|
30
|
+
import { completeInteractionModel, modelContextWindow } from "../providers/pi.js";
|
|
31
31
|
import type {
|
|
32
32
|
AwsAssumeRoleProviderAuth,
|
|
33
33
|
AwsSigV4ProviderAuth,
|
|
34
34
|
ProviderAuth,
|
|
35
35
|
ResolvedRouter,
|
|
36
|
-
} from "../types";
|
|
37
|
-
import { deriveFallbackDecision } from "./fallback_decision";
|
|
38
|
-
import type { SelectorImage } from "./selector_projection";
|
|
36
|
+
} from "../types.js";
|
|
37
|
+
import { deriveFallbackDecision } from "./fallback_decision.js";
|
|
38
|
+
import type { SelectorImage } from "./selector_projection.js";
|
|
39
39
|
|
|
40
40
|
export function resolveRouter(args: ResolveRouterRequest): Promise<ResolvedRouter> {
|
|
41
41
|
return gatewayPlatform().resolveRouter(args);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { ChatMessage } from "@mupt-ai/dari-router/policy-engine";
|
|
2
2
|
|
|
3
|
-
import { toolWireName } from "../interaction/tool_identity";
|
|
3
|
+
import { toolWireName } from "../interaction/tool_identity.js";
|
|
4
4
|
import type {
|
|
5
5
|
InteractionContent,
|
|
6
6
|
InteractionMessage,
|
|
7
7
|
InteractionRequest,
|
|
8
8
|
InteractionToolCall,
|
|
9
|
-
} from "../interaction/types";
|
|
9
|
+
} from "../interaction/types.js";
|
|
10
10
|
|
|
11
11
|
export const IMAGE_OMITTED = "<image omitted>";
|
|
12
12
|
// Matches every numbered placeholder in a rendered selector prompt.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { InteractionUsage } from "../interaction/types";
|
|
2
|
-
import type { ProviderKeySource } from "../types";
|
|
3
|
-
import { finiteNumber, isRecord, tokenCount } from "./ingest_values";
|
|
1
|
+
import type { InteractionUsage } from "../interaction/types.js";
|
|
2
|
+
import type { ProviderKeySource } from "../types.js";
|
|
3
|
+
import { finiteNumber, isRecord, tokenCount } from "./ingest_values.js";
|
|
4
4
|
|
|
5
5
|
const BILLING_EVENT_SCHEMA_VERSION = 1;
|
|
6
6
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RoutingBillingProviderAttemptFacts } from "./billing_finalization";
|
|
1
|
+
import type { RoutingBillingProviderAttemptFacts } from "./billing_finalization.js";
|
|
2
2
|
|
|
3
3
|
/** Model reference cost only, including retries; unknown/estimated usage is never free. */
|
|
4
4
|
export function modelCost(attempts: readonly RoutingBillingProviderAttemptFacts[]): number | null {
|
|
@@ -6,15 +6,15 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
extendInteractionChain,
|
|
8
8
|
extendInteractionLooseChain,
|
|
9
|
-
} from "../context/interaction_fingerprint";
|
|
9
|
+
} from "../context/interaction_fingerprint.js";
|
|
10
10
|
import type {
|
|
11
11
|
InteractionOutput,
|
|
12
12
|
InteractionRequest,
|
|
13
13
|
InteractionUsage,
|
|
14
14
|
ProviderIdentity,
|
|
15
|
-
} from "../interaction/types";
|
|
16
|
-
import { gatewayPlatform, type PrefixStateWrite } from "../platform/platform";
|
|
17
|
-
import { tokenCount } from "./ingest_values";
|
|
15
|
+
} from "../interaction/types.js";
|
|
16
|
+
import { gatewayPlatform, type PrefixStateWrite } from "../platform/platform.js";
|
|
17
|
+
import { tokenCount } from "./ingest_values.js";
|
|
18
18
|
|
|
19
19
|
export type CompletedPrefixHit = Omit<RouterPrefixHit, "updated_at"> & {
|
|
20
20
|
lease_depth: number;
|
package/src/telemetry/report.ts
CHANGED
|
@@ -14,34 +14,34 @@ import {
|
|
|
14
14
|
type RoutingDecision,
|
|
15
15
|
type RoutingStrategy,
|
|
16
16
|
} from "@mupt-ai/dari-router/policy-engine";
|
|
17
|
-
import type { ImageCapabilityPrunedModel } from "../context/routing_context";
|
|
18
|
-
import { HttpError, errorCode } from "../http/errors";
|
|
19
|
-
import { executionProviderForModel } from "../models/execution_provider";
|
|
17
|
+
import type { ImageCapabilityPrunedModel } from "../context/routing_context.js";
|
|
18
|
+
import { HttpError, errorCode } from "../http/errors.js";
|
|
19
|
+
import { executionProviderForModel } from "../models/execution_provider.js";
|
|
20
20
|
import {
|
|
21
21
|
isBackgroundRequest,
|
|
22
22
|
type InteractionOutput,
|
|
23
23
|
type InteractionRequest,
|
|
24
24
|
type InteractionUsage,
|
|
25
25
|
type ProviderIdentity,
|
|
26
|
-
} from "../interaction/types";
|
|
27
|
-
import { captureOperationalError } from "../observability/errors";
|
|
28
|
-
import { gatewayPlatform, type RequestTags } from "../platform/platform";
|
|
26
|
+
} from "../interaction/types.js";
|
|
27
|
+
import { captureOperationalError } from "../observability/errors.js";
|
|
28
|
+
import { gatewayPlatform, type RequestTags } from "../platform/platform.js";
|
|
29
29
|
import type {
|
|
30
30
|
ProviderAttemptRecord,
|
|
31
31
|
ProviderAttemptReport,
|
|
32
32
|
FrozenProviderTerminal,
|
|
33
33
|
ReportableProviderOutcome,
|
|
34
34
|
ReportedProviderExecution,
|
|
35
|
-
} from "../runtime/runtime_reporter";
|
|
35
|
+
} from "../runtime/runtime_reporter.js";
|
|
36
36
|
import {
|
|
37
37
|
selectorTraceFromError,
|
|
38
38
|
type SelectorRun,
|
|
39
39
|
type SelectorTrace,
|
|
40
|
-
} from "../strategies/routing";
|
|
41
|
-
import type { ResolvedRouter } from "../types";
|
|
42
|
-
import type { HarnessConversationIdentity } from "../runtime/harness_identity";
|
|
43
|
-
import { trackBackgroundTelemetry } from "./background";
|
|
44
|
-
import { modelCost } from "./model_cost";
|
|
40
|
+
} from "../strategies/routing.js";
|
|
41
|
+
import type { ResolvedRouter } from "../types.js";
|
|
42
|
+
import type { HarnessConversationIdentity } from "../runtime/harness_identity/index.js";
|
|
43
|
+
import { trackBackgroundTelemetry } from "./background.js";
|
|
44
|
+
import { modelCost } from "./model_cost.js";
|
|
45
45
|
import {
|
|
46
46
|
routingBillingProviderAttemptFacts,
|
|
47
47
|
type FrozenRoutingBillingTerminal,
|
|
@@ -49,26 +49,26 @@ import {
|
|
|
49
49
|
type RoutingBillingFinalizationPayload,
|
|
50
50
|
type RoutingBillingProviderAttemptFacts,
|
|
51
51
|
type RoutingBillingTerminalOutcome,
|
|
52
|
-
} from "./billing_finalization";
|
|
53
|
-
import { estimateBenchmarkReplay } from "./benchmark_replay";
|
|
54
|
-
import { extractInteractionObservability } from "./requests/interaction_observability";
|
|
52
|
+
} from "./billing_finalization.js";
|
|
53
|
+
import { estimateBenchmarkReplay } from "./benchmark_replay.js";
|
|
54
|
+
import { extractInteractionObservability } from "./requests/interaction_observability.js";
|
|
55
55
|
import {
|
|
56
56
|
costString,
|
|
57
57
|
finiteNumber,
|
|
58
58
|
isRecord,
|
|
59
59
|
tokenCount,
|
|
60
|
-
} from "./ingest_values";
|
|
60
|
+
} from "./ingest_values.js";
|
|
61
61
|
import {
|
|
62
62
|
buildCompletedPrefixHit,
|
|
63
63
|
leaseCountdownForPrefix,
|
|
64
64
|
prefixEntryForIngest,
|
|
65
65
|
reportPendingLease,
|
|
66
66
|
reportPrefixState,
|
|
67
|
-
} from "./prefix_state";
|
|
68
|
-
import { subscriptionUsageLimitFromFailure } from "../providers/subscription_limits";
|
|
69
|
-
import { scrubSecrets } from "./scrub";
|
|
70
|
-
import { encodeRetainedInteractionRequest } from "./requests/retained_interaction_request";
|
|
71
|
-
import { toolResultObservations, toolSkillEvents } from "./tools/observations";
|
|
67
|
+
} from "./prefix_state.js";
|
|
68
|
+
import { subscriptionUsageLimitFromFailure } from "../providers/subscription_limits.js";
|
|
69
|
+
import { scrubSecrets } from "./scrub.js";
|
|
70
|
+
import { encodeRetainedInteractionRequest } from "./requests/retained_interaction_request.js";
|
|
71
|
+
import { toolResultObservations, toolSkillEvents } from "./tools/observations.js";
|
|
72
72
|
|
|
73
73
|
// The decision's candidate_pruning audit: core cache-aware pruning, extended
|
|
74
74
|
// with models excluded up front for missing hard capabilities (image input).
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
InteractionOutput,
|
|
3
3
|
InteractionRequest,
|
|
4
|
-
} from "../../../interaction/types";
|
|
5
|
-
import { interactionToolInput } from "../../tools/input";
|
|
4
|
+
} from "../../../interaction/types.js";
|
|
5
|
+
import { interactionToolInput } from "../../tools/input.js";
|
|
6
6
|
import {
|
|
7
7
|
claudeSkillCapabilityId,
|
|
8
8
|
claudeSystemSkillNames,
|
|
9
|
-
} from "./catalog";
|
|
9
|
+
} from "./catalog.js";
|
|
10
10
|
import {
|
|
11
11
|
normalizedAbsoluteSkillPath,
|
|
12
12
|
skillPathSegments,
|
|
13
13
|
type NormalizedSkillPath,
|
|
14
|
-
} from "../paths";
|
|
15
|
-
import type { SkillObservation } from "../observations";
|
|
16
|
-
import { readPathsFromShellCommand } from "../shell_file_reads";
|
|
14
|
+
} from "../paths.js";
|
|
15
|
+
import type { SkillObservation } from "../observations.js";
|
|
16
|
+
import { readPathsFromShellCommand } from "../shell_file_reads.js";
|
|
17
17
|
|
|
18
18
|
const MAX_COMMAND_CHARS = 64 * 1024;
|
|
19
19
|
const SKILL_FILE_NAME = "SKILL.md";
|
|
@@ -5,16 +5,16 @@ import type {
|
|
|
5
5
|
InteractionRequest,
|
|
6
6
|
InteractionToolCall,
|
|
7
7
|
InteractionToolResult,
|
|
8
|
-
} from "../../../interaction/types";
|
|
8
|
+
} from "../../../interaction/types.js";
|
|
9
9
|
import type {
|
|
10
10
|
SkillEvidenceSource,
|
|
11
11
|
SkillObservation,
|
|
12
|
-
} from "../observations";
|
|
12
|
+
} from "../observations.js";
|
|
13
13
|
import {
|
|
14
14
|
claudeAvailableSkillNames,
|
|
15
15
|
claudeSkillCapabilityId,
|
|
16
16
|
normalizedClaudeSkillName,
|
|
17
|
-
} from "./catalog";
|
|
17
|
+
} from "./catalog.js";
|
|
18
18
|
|
|
19
19
|
const MAX_SKILL_PATH_CHARS = 16 * 1024;
|
|
20
20
|
const UNSAFE_DISPLAY_CHARACTERS = /[\u0000-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/u;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { InteractionRequest } from "../../../interaction/types";
|
|
2
|
-
import { normalizedCodexSkillName } from "./identity";
|
|
1
|
+
import type { InteractionRequest } from "../../../interaction/types.js";
|
|
2
|
+
import { normalizedCodexSkillName } from "./identity.js";
|
|
3
3
|
import {
|
|
4
4
|
joinedSkillPath,
|
|
5
5
|
normalizedAbsoluteSkillPath,
|
|
6
6
|
skillPathBasename,
|
|
7
7
|
type NormalizedSkillPath,
|
|
8
8
|
type PathPlatform,
|
|
9
|
-
} from "../paths";
|
|
9
|
+
} from "../paths.js";
|
|
10
10
|
|
|
11
11
|
const MAX_CATALOG_ENTRIES = 2_000;
|
|
12
12
|
const SKILLS_OPEN = "<skills_instructions>";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { InteractionOutput } from "../../../interaction/types";
|
|
2
|
-
import { interactionToolInput } from "../../tools/input";
|
|
3
|
-
import { readPathsFromShellCommand } from "../shell_file_reads";
|
|
4
|
-
import type { CatalogSkill, CodexSkillCatalog } from "./catalog";
|
|
1
|
+
import type { InteractionOutput } from "../../../interaction/types.js";
|
|
2
|
+
import { interactionToolInput } from "../../tools/input.js";
|
|
3
|
+
import { readPathsFromShellCommand } from "../shell_file_reads.js";
|
|
4
|
+
import type { CatalogSkill, CodexSkillCatalog } from "./catalog.js";
|
|
5
5
|
|
|
6
6
|
const MAX_COMMAND_CHARS = 64 * 1024;
|
|
7
7
|
const MAX_SKILL_PATH_CHARS = 16 * 1024;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
InteractionMessage,
|
|
3
3
|
InteractionRequest,
|
|
4
|
-
} from "../../../interaction/types";
|
|
5
|
-
import type { SkillObservation } from "../observations";
|
|
4
|
+
} from "../../../interaction/types.js";
|
|
5
|
+
import type { SkillObservation } from "../observations.js";
|
|
6
6
|
import {
|
|
7
7
|
codexSkillCapabilityId,
|
|
8
8
|
normalizedCodexSkillName,
|
|
9
|
-
} from "./identity";
|
|
9
|
+
} from "./identity.js";
|
|
10
10
|
|
|
11
11
|
const MAX_SKILL_PATH_CHARS = 16 * 1024;
|
|
12
12
|
const UNSAFE_DISPLAY_CHARACTERS = /[\u0000-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/u;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
InteractionOutput,
|
|
3
3
|
InteractionRequest,
|
|
4
|
-
} from "../../../interaction/types";
|
|
4
|
+
} from "../../../interaction/types.js";
|
|
5
5
|
import {
|
|
6
6
|
codexExecCommand,
|
|
7
7
|
readSkillsFromCodexCommand,
|
|
8
|
-
} from "./exec_file_reads";
|
|
9
|
-
import { codexFileSkillCatalog } from "./catalog";
|
|
10
|
-
import { codexSkillCapabilityId } from "./identity";
|
|
11
|
-
import type { SkillObservation } from "../observations";
|
|
8
|
+
} from "./exec_file_reads.js";
|
|
9
|
+
import { codexFileSkillCatalog } from "./catalog.js";
|
|
10
|
+
import { codexSkillCapabilityId } from "./identity.js";
|
|
11
|
+
import type { SkillObservation } from "../observations.js";
|
|
12
12
|
|
|
13
13
|
/** Match model-emitted Codex file reads to the exact current skill catalog. */
|
|
14
14
|
export function codexAutomaticSkillObservations(
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { isBackgroundRequest, type InteractionOutput, type InteractionRequest } from "../../interaction/types";
|
|
2
|
-
import type { HarnessConversationIdentity } from "../../runtime/harness_identity";
|
|
1
|
+
import { isBackgroundRequest, type InteractionOutput, type InteractionRequest } from "../../interaction/types.js";
|
|
2
|
+
import type { HarnessConversationIdentity } from "../../runtime/harness_identity/index.js";
|
|
3
3
|
import {
|
|
4
4
|
piStyleAutomaticSkillObservations,
|
|
5
5
|
piStyleExplicitSkillObservations,
|
|
6
|
-
} from "./pi";
|
|
7
|
-
import { claudeFileReadObservations } from "./claude/file_reads";
|
|
8
|
-
import { claudeSkillObservations } from "./claude/observations";
|
|
9
|
-
import { codexExplicitSkillObservations } from "./codex/explicit";
|
|
10
|
-
import { codexAutomaticSkillObservations } from "./codex/file_reads";
|
|
6
|
+
} from "./pi.js";
|
|
7
|
+
import { claudeFileReadObservations } from "./claude/file_reads.js";
|
|
8
|
+
import { claudeSkillObservations } from "./claude/observations.js";
|
|
9
|
+
import { codexExplicitSkillObservations } from "./codex/explicit.js";
|
|
10
|
+
import { codexAutomaticSkillObservations } from "./codex/file_reads.js";
|
|
11
11
|
|
|
12
12
|
export type SkillEvidenceSource =
|
|
13
13
|
| "skill_content_injection"
|
|
@@ -2,9 +2,9 @@ import type {
|
|
|
2
2
|
InteractionMessage,
|
|
3
3
|
InteractionOutput,
|
|
4
4
|
InteractionRequest,
|
|
5
|
-
} from "../../interaction/types";
|
|
6
|
-
import { interactionToolInput } from "../tools/input";
|
|
7
|
-
import type { SkillObservation } from "./observations";
|
|
5
|
+
} from "../../interaction/types.js";
|
|
6
|
+
import { interactionToolInput } from "../tools/input.js";
|
|
7
|
+
import type { SkillObservation } from "./observations.js";
|
|
8
8
|
|
|
9
9
|
const CAPABILITY_PREFIX = "unattributed:name:";
|
|
10
10
|
const MAX_CAPABILITY_ID_CHARS = 512;
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
resolvedSkillPath,
|
|
4
4
|
type NormalizedSkillPath,
|
|
5
5
|
type PathPlatform,
|
|
6
|
-
} from "./paths";
|
|
6
|
+
} from "./paths.js";
|
|
7
7
|
import {
|
|
8
8
|
executableCommand,
|
|
9
9
|
restrictedShellSegments,
|
|
10
10
|
trustedExecutableName,
|
|
11
11
|
type ShellOperator,
|
|
12
|
-
} from "./shell_words";
|
|
12
|
+
} from "./shell_words.js";
|
|
13
13
|
|
|
14
14
|
const MAX_SHELL_NESTING = 16;
|
|
15
15
|
const NO_VALUE_FLAGS = new Set<string>();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isRecord } from "@mupt-ai/dari-router/policy-engine";
|
|
2
2
|
|
|
3
|
-
import type { InteractionToolCall } from "../../interaction/types";
|
|
3
|
+
import type { InteractionToolCall } from "../../interaction/types.js";
|
|
4
4
|
|
|
5
5
|
export function interactionToolInput(
|
|
6
6
|
item: InteractionToolCall,
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { isRecord, stableStringify } from "@mupt-ai/dari-router/policy-engine";
|
|
2
2
|
|
|
3
|
-
import { interactionPrefixChain } from "../../context/interaction_fingerprint";
|
|
3
|
+
import { interactionPrefixChain } from "../../context/interaction_fingerprint.js";
|
|
4
4
|
import type {
|
|
5
5
|
InteractionContent,
|
|
6
6
|
InteractionItem,
|
|
7
7
|
InteractionOutput,
|
|
8
8
|
InteractionRequest,
|
|
9
9
|
InteractionToolResult,
|
|
10
|
-
} from "../../interaction/types";
|
|
11
|
-
import { isProtocolToolCallId } from "../../interaction/tool_identity";
|
|
12
|
-
import { anthropicMessagesToInteraction } from "../../protocol/input/anthropic_messages";
|
|
13
|
-
import { internalChatCompletionsToInteraction } from "../../protocol/input/chat_completions";
|
|
14
|
-
import { anthropicContent } from "../../protocol/output/anthropic_messages_output";
|
|
15
|
-
import { assistantMessagePayload } from "../../protocol/output/chat_completions";
|
|
16
|
-
import type { HarnessConversationIdentity } from "../../runtime/harness_identity";
|
|
10
|
+
} from "../../interaction/types.js";
|
|
11
|
+
import { isProtocolToolCallId } from "../../interaction/tool_identity.js";
|
|
12
|
+
import { anthropicMessagesToInteraction } from "../../protocol/input/anthropic_messages.js";
|
|
13
|
+
import { internalChatCompletionsToInteraction } from "../../protocol/input/chat_completions.js";
|
|
14
|
+
import { anthropicContent } from "../../protocol/output/anthropic_messages_output.js";
|
|
15
|
+
import { assistantMessagePayload } from "../../protocol/output/chat_completions.js";
|
|
16
|
+
import type { HarnessConversationIdentity } from "../../runtime/harness_identity/index.js";
|
|
17
17
|
import {
|
|
18
18
|
inputSkillObservations,
|
|
19
19
|
outputSkillObservations,
|
|
20
|
-
} from "../skills/observations";
|
|
20
|
+
} from "../skills/observations.js";
|
|
21
21
|
|
|
22
22
|
const MAX_TOOL_SKILL_EVENTS = 1000;
|
|
23
23
|
|
package/src/telemetry/usage.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Provider } from "@mupt-ai/dari-router/policy-engine";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
|
|
4
|
-
import { HttpError } from "../http/errors";
|
|
5
|
-
import { executionProviderForModel, keySourceForModel } from "../models/execution_provider";
|
|
6
|
-
import { captureOperationalError } from "../observability/errors";
|
|
7
|
-
import { gatewayPlatform, type RequestTags } from "../platform/platform";
|
|
8
|
-
import type { ProviderKeySource, ResolvedRouter } from "../types";
|
|
4
|
+
import { HttpError } from "../http/errors.js";
|
|
5
|
+
import { executionProviderForModel, keySourceForModel } from "../models/execution_provider.js";
|
|
6
|
+
import { captureOperationalError } from "../observability/errors.js";
|
|
7
|
+
import { gatewayPlatform, type RequestTags } from "../platform/platform.js";
|
|
8
|
+
import type { ProviderKeySource, ResolvedRouter } from "../types.js";
|
|
9
9
|
|
|
10
10
|
export type RoutingUsageContext = {
|
|
11
11
|
organizationId: string;
|
package/src/types.ts
CHANGED
|
@@ -42,12 +42,25 @@ export type AwsAssumeRoleProviderAuth = {
|
|
|
42
42
|
// Authentication a provider call can use directly.
|
|
43
43
|
export type ResolvedProviderAuth = BearerProviderAuth | AwsSigV4ProviderAuth;
|
|
44
44
|
|
|
45
|
+
// A personal plan whose access token serves its provider's models in place of
|
|
46
|
+
// an API key:
|
|
47
|
+
// - "openai_codex": a ChatGPT plan; the token is Codex's auth.json
|
|
48
|
+
// `tokens.access_token`, served through the Codex backend.
|
|
49
|
+
// - "anthropic_claude_code": a Claude Code plan; the token is the OAuth token
|
|
50
|
+
// `claude setup-token` prints. It serves Claude Code clients only.
|
|
51
|
+
// - "meta_muse": a Meta (Muse) sign-in; the token is the Model API key the
|
|
52
|
+
// sign-in mints (Pi's Meta OAuth `access`).
|
|
53
|
+
export type SubscriptionKind = "openai_codex" | "anthropic_claude_code" | "meta_muse";
|
|
54
|
+
|
|
45
55
|
// A bearer credential an embedding platform supplies for one request through
|
|
46
56
|
// GatewayPlatform.resolveProviderCredential, optionally with its own endpoint.
|
|
57
|
+
// With `subscription`, `apiKey` is that plan's access token; the platform keeps
|
|
58
|
+
// it fresh.
|
|
47
59
|
export type ProviderCredential = {
|
|
48
60
|
apiKey: string;
|
|
49
61
|
baseUrl?: string;
|
|
50
62
|
headers?: Record<string, string>;
|
|
63
|
+
subscription?: SubscriptionKind;
|
|
51
64
|
};
|
|
52
65
|
|
|
53
66
|
export type ProviderAuth = ResolvedProviderAuth | AwsAssumeRoleProviderAuth;
|
|
@@ -70,7 +83,7 @@ export type PublicEvalCatalogCard = Omit<RouterEval, "scores"> & {
|
|
|
70
83
|
scores: PublicEvalCatalogScore[];
|
|
71
84
|
};
|
|
72
85
|
|
|
73
|
-
export type ClientHarness = "claude_code";
|
|
86
|
+
export type ClientHarness = "claude_code" | "muse_code";
|
|
74
87
|
|
|
75
88
|
export type ResolvedRouterModelConfig = {
|
|
76
89
|
provider: string;
|
|
@@ -111,9 +124,13 @@ export type ResolvedRouter = {
|
|
|
111
124
|
speculative_routing?: boolean;
|
|
112
125
|
primary_retries?: number;
|
|
113
126
|
// Serve only the requested `dari/model/<id>` at the requested thinking
|
|
114
|
-
// level: no selector, lease, fallback, or personal subscription
|
|
115
|
-
//
|
|
127
|
+
// level: no selector, lease, fallback, or personal subscription the
|
|
128
|
+
// platform did not supply through resolveProviderCredential, and an error
|
|
129
|
+
// for anything else, whatever the client sends.
|
|
116
130
|
strict?: boolean;
|
|
131
|
+
// On strict routers only, allow requested catalog models of these providers.
|
|
132
|
+
// Requires dari/model/<provider>/<id>; never enables fallback.
|
|
133
|
+
strict_providers?: string[];
|
|
117
134
|
model_fallback_enabled?: boolean;
|
|
118
135
|
fallback_requires_different_provider?: boolean;
|
|
119
136
|
evals?: RouterEval[];
|