@omnicross/contracts 0.1.2 → 0.1.4

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.
Files changed (47) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +15 -15
  3. package/dist/account-tokens-types.d.cts +157 -1
  4. package/dist/account-tokens-types.d.ts +157 -1
  5. package/dist/audit-types.cjs +36 -0
  6. package/dist/audit-types.d.cts +98 -0
  7. package/dist/audit-types.d.ts +98 -0
  8. package/dist/audit-types.js +11 -0
  9. package/dist/billing-types.cjs +33 -0
  10. package/dist/billing-types.d.cts +98 -0
  11. package/dist/billing-types.d.ts +98 -0
  12. package/dist/billing-types.js +8 -0
  13. package/dist/canonical-models.d.cts +1 -1
  14. package/dist/canonical-models.d.ts +1 -1
  15. package/dist/endpoint-resolver.d.cts +1 -1
  16. package/dist/endpoint-resolver.d.ts +1 -1
  17. package/dist/health-logging-types.cjs +32 -0
  18. package/dist/health-logging-types.d.cts +68 -0
  19. package/dist/health-logging-types.d.ts +68 -0
  20. package/dist/health-logging-types.js +7 -0
  21. package/dist/index.cjs +63 -0
  22. package/dist/index.d.cts +9 -3
  23. package/dist/index.d.ts +9 -3
  24. package/dist/index.js +55 -0
  25. package/dist/{llm-config-D1jKQLVp.d.ts → llm-config-CKOaFFdy.d.ts} +8 -1
  26. package/dist/{llm-config-CQjOimv2.d.cts → llm-config-DeWNx1ig.d.cts} +8 -1
  27. package/dist/llm-config.d.cts +1 -1
  28. package/dist/llm-config.d.ts +1 -1
  29. package/dist/provider-presets/index.d.cts +2 -2
  30. package/dist/provider-presets/index.d.ts +2 -2
  31. package/dist/subscription-model-catalog.cjs +40 -0
  32. package/dist/subscription-model-catalog.d.cts +34 -0
  33. package/dist/subscription-model-catalog.d.ts +34 -0
  34. package/dist/subscription-model-catalog.js +14 -0
  35. package/dist/thinking-config.d.cts +1 -1
  36. package/dist/thinking-config.d.ts +1 -1
  37. package/dist/usage-stats-types.d.cts +22 -1
  38. package/dist/usage-stats-types.d.ts +22 -1
  39. package/dist/voucher-types.cjs +32 -0
  40. package/dist/voucher-types.d.cts +153 -0
  41. package/dist/voucher-types.d.ts +153 -0
  42. package/dist/voucher-types.js +7 -0
  43. package/dist/webhook-types.cjs +40 -0
  44. package/dist/webhook-types.d.cts +122 -0
  45. package/dist/webhook-types.d.ts +122 -0
  46. package/dist/webhook-types.js +14 -0
  47. package/package.json +156 -126
package/dist/index.cjs CHANGED
@@ -24,10 +24,13 @@ __export(index_exports, {
24
24
  CANNOT_DISABLE_THINKING_PATTERNS: () => CANNOT_DISABLE_THINKING_PATTERNS,
25
25
  CATALOG_VERSION: () => CATALOG_VERSION,
26
26
  CODING_PLAN_URL_PRESETS: () => CODING_PLAN_URL_PRESETS,
27
+ DEFAULT_AUDIT_CONFIG: () => DEFAULT_AUDIT_CONFIG,
28
+ DEFAULT_BILLING_CONFIG: () => DEFAULT_BILLING_CONFIG,
27
29
  DEFAULT_LITELLM_PRICING_URL: () => DEFAULT_LITELLM_PRICING_URL,
28
30
  DEFAULT_MAX_TOKENS: () => DEFAULT_MAX_TOKENS,
29
31
  DEFAULT_MCP_SESSION_CONFIG: () => DEFAULT_MCP_SESSION_CONFIG,
30
32
  DEFAULT_SEED_PRESET_IDS: () => DEFAULT_SEED_PRESET_IDS,
33
+ DEFAULT_VOUCHER_CONFIG: () => DEFAULT_VOUCHER_CONFIG,
31
34
  EFFORT_RATIO: () => EFFORT_RATIO,
32
35
  EXTENDED_CONTEXT_CAPABLE_MODELS: () => EXTENDED_CONTEXT_CAPABLE_MODELS,
33
36
  KNOWN_MODELS: () => KNOWN_MODELS,
@@ -37,7 +40,10 @@ __export(index_exports, {
37
40
  PROVIDER_MODEL_MAPPINGS: () => PROVIDER_MODEL_MAPPINGS,
38
41
  PROVIDER_SEARCH_CONFIGS: () => PROVIDER_SEARCH_CONFIGS,
39
42
  REASONING_MODEL_PATTERNS: () => REASONING_MODEL_PATTERNS,
43
+ SUBSCRIPTION_MODEL_CATALOG: () => SUBSCRIPTION_MODEL_CATALOG,
40
44
  THINKING_TOKEN_MAP: () => THINKING_TOKEN_MAP,
45
+ WEBHOOK_DESTINATION_TYPES: () => WEBHOOK_DESTINATION_TYPES,
46
+ WEBHOOK_EVENT_KINDS: () => WEBHOOK_EVENT_KINDS,
41
47
  applyAlias: () => applyAlias,
42
48
  buildAnthropicThinking: () => buildAnthropicThinking,
43
49
  buildGeminiThinkingConfig: () => buildGeminiThinkingConfig,
@@ -52,6 +58,7 @@ __export(index_exports, {
52
58
  getPresetById: () => getPresetById,
53
59
  getPresetRevision: () => getPresetRevision,
54
60
  getProviderSearchConfig: () => getProviderSearchConfig,
61
+ healthHttpStatus: () => healthHttpStatus,
55
62
  isApiProvider: () => isApiProvider,
56
63
  isExtendedContextCapable: () => isExtendedContextCapable,
57
64
  isLocalProvider: () => isLocalProvider,
@@ -62,10 +69,26 @@ __export(index_exports, {
62
69
  resolveFollowProviderModel: () => resolveFollowProviderModel,
63
70
  resolveModelCapabilities: () => resolveModelCapabilities,
64
71
  resolveProviderEndpoint: () => resolveProviderEndpoint,
72
+ subscriptionProviderHasCatalog: () => subscriptionProviderHasCatalog,
65
73
  subscriptionTargetForSession: () => subscriptionTargetForSession
66
74
  });
67
75
  module.exports = __toCommonJS(index_exports);
68
76
 
77
+ // src/audit-types.ts
78
+ var DEFAULT_AUDIT_CONFIG = {
79
+ enabled: false,
80
+ captureBodies: false,
81
+ maxBodyBytes: 8192,
82
+ retentionDays: 7,
83
+ trustForwardedFor: false
84
+ };
85
+
86
+ // src/billing-types.ts
87
+ var DEFAULT_BILLING_CONFIG = {
88
+ enabled: false,
89
+ maxRetryAgeMs: 24 * 60 * 6e4
90
+ };
91
+
69
92
  // src/canonical-models.ts
70
93
  var OPENAI_MODELS = {
71
94
  "gpt-5.5": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
@@ -328,6 +351,11 @@ function isExtendedContextCapable(model) {
328
351
  return EXTENDED_CONTEXT_CAPABLE_MODELS.has(model);
329
352
  }
330
353
 
354
+ // src/health-logging-types.ts
355
+ function healthHttpStatus(status) {
356
+ return status === "ok" ? 200 : 503;
357
+ }
358
+
331
359
  // src/mcp-types.ts
332
360
  var DEFAULT_MCP_SESSION_CONFIG = {
333
361
  mode: "auto",
@@ -2465,6 +2493,17 @@ function getProviderSearchConfig(presetId) {
2465
2493
  return PROVIDER_SEARCH_CONFIGS[presetId];
2466
2494
  }
2467
2495
 
2496
+ // src/subscription-model-catalog.ts
2497
+ var SUBSCRIPTION_MODEL_CATALOG = {
2498
+ claude: ["claude-haiku-4-5", "claude-sonnet-5", "claude-opus-5", "claude-fable-5"],
2499
+ codex: ["gpt-5.6-luna", "gpt-5.6-terra", "gpt-5.6-sol"],
2500
+ gemini: [],
2501
+ opencodego: []
2502
+ };
2503
+ function subscriptionProviderHasCatalog(providerId) {
2504
+ return SUBSCRIPTION_MODEL_CATALOG[providerId].length > 0;
2505
+ }
2506
+
2468
2507
  // src/subscription-types.ts
2469
2508
  function legacyCliBackendToSubscriptionProvider(cliBackend) {
2470
2509
  switch (cliBackend) {
@@ -2674,6 +2713,22 @@ function buildQwenThinkingConfig(level, userMaxTokens) {
2674
2713
  };
2675
2714
  }
2676
2715
 
2716
+ // src/voucher-types.ts
2717
+ var DEFAULT_VOUCHER_CONFIG = {
2718
+ enabled: false
2719
+ };
2720
+
2721
+ // src/webhook-types.ts
2722
+ var WEBHOOK_EVENT_KINDS = [
2723
+ "account.recovery",
2724
+ "account.anomaly",
2725
+ "key.quotaWarning",
2726
+ "key.quotaExceeded",
2727
+ "server.error",
2728
+ "test"
2729
+ ];
2730
+ var WEBHOOK_DESTINATION_TYPES = ["custom", "feishu"];
2731
+
2677
2732
  // src/websearch-types.ts
2678
2733
  function isApiProvider(id) {
2679
2734
  return !id.startsWith("local-");
@@ -2687,10 +2742,13 @@ function isLocalProvider(id) {
2687
2742
  CANNOT_DISABLE_THINKING_PATTERNS,
2688
2743
  CATALOG_VERSION,
2689
2744
  CODING_PLAN_URL_PRESETS,
2745
+ DEFAULT_AUDIT_CONFIG,
2746
+ DEFAULT_BILLING_CONFIG,
2690
2747
  DEFAULT_LITELLM_PRICING_URL,
2691
2748
  DEFAULT_MAX_TOKENS,
2692
2749
  DEFAULT_MCP_SESSION_CONFIG,
2693
2750
  DEFAULT_SEED_PRESET_IDS,
2751
+ DEFAULT_VOUCHER_CONFIG,
2694
2752
  EFFORT_RATIO,
2695
2753
  EXTENDED_CONTEXT_CAPABLE_MODELS,
2696
2754
  KNOWN_MODELS,
@@ -2700,7 +2758,10 @@ function isLocalProvider(id) {
2700
2758
  PROVIDER_MODEL_MAPPINGS,
2701
2759
  PROVIDER_SEARCH_CONFIGS,
2702
2760
  REASONING_MODEL_PATTERNS,
2761
+ SUBSCRIPTION_MODEL_CATALOG,
2703
2762
  THINKING_TOKEN_MAP,
2763
+ WEBHOOK_DESTINATION_TYPES,
2764
+ WEBHOOK_EVENT_KINDS,
2704
2765
  applyAlias,
2705
2766
  buildAnthropicThinking,
2706
2767
  buildGeminiThinkingConfig,
@@ -2715,6 +2776,7 @@ function isLocalProvider(id) {
2715
2776
  getPresetById,
2716
2777
  getPresetRevision,
2717
2778
  getProviderSearchConfig,
2779
+ healthHttpStatus,
2718
2780
  isApiProvider,
2719
2781
  isExtendedContextCapable,
2720
2782
  isLocalProvider,
@@ -2725,5 +2787,6 @@ function isLocalProvider(id) {
2725
2787
  resolveFollowProviderModel,
2726
2788
  resolveModelCapabilities,
2727
2789
  resolveProviderEndpoint,
2790
+ subscriptionProviderHasCatalog,
2728
2791
  subscriptionTargetForSession
2729
2792
  });
package/dist/index.d.cts CHANGED
@@ -1,16 +1,22 @@
1
- export { AccountTokensConfig, AuthMethod, ClaudeAuthMethod, ClaudeTokenConfig, CodexTokenConfig, GeminiTokenConfig, OAuthParams, SubscriptionAccountEntry, SubscriptionAccountSanitized, SubscriptionLevel, SyncWarningCode, TokenExchangeRequest, TokenStatus } from './account-tokens-types.cjs';
1
+ export { AccountClientIdentity, AccountTokensConfig, AuthMethod, ClaudeAuthMethod, ClaudeTokenConfig, CodexTokenConfig, GeminiTokenConfig, OAuthParams, ProxyConfig, SanitizedProxyConfig, SubscriptionAccountEntry, SubscriptionAccountSanitized, SubscriptionLevel, SyncWarningCode, TokenExchangeRequest, TokenStatus } from './account-tokens-types.cjs';
2
+ export { AuditConfig, AuditQueryResult, AuditRecord, DEFAULT_AUDIT_CONFIG } from './audit-types.cjs';
3
+ export { BillingConfig, BillingDeliveryStatus, BillingEvent, DEFAULT_BILLING_CONFIG } from './billing-types.cjs';
2
4
  export { KNOWN_MODELS, KnownModelCapabilities, MODEL_ALIASES, ResolvedModelCapabilities, applyAlias, lookupCanonicalCapabilities, normalizeModelId, resolveModelCapabilities } from './canonical-models.cjs';
3
5
  export { AnthropicAudioContent, AnthropicChatRequest, AnthropicChatResponse, AnthropicContentPart, AnthropicImageContent, AnthropicMessage, AnthropicSystemContent, AnthropicTextContent, AnthropicThinkingContent, AnthropicTool, AnthropicToolResultContent, AnthropicToolUseContent, AnthropicVideoContent, ConversionConfig, OpenAIChatRequest, OpenAIChatResponse, OpenAIContentPart, OpenAIMessage, OpenAIStreamChunk, OpenAITool, OpenAIToolCall, SimpleChatAudio, SimpleChatImage, SimpleChatMessage, SimpleChatSession, SimpleChatVideo } from './completion-types.cjs';
4
6
  export { R as ReasoningConfig, T as ThinkLevel, a as ThinkingContent } from './thinking-CBWSLel8.cjs';
5
7
  export { ResolvedEndpoint, resolveProviderEndpoint } from './endpoint-resolver.cjs';
6
8
  export { EXTENDED_CONTEXT_CAPABLE_MODELS, isExtendedContextCapable } from './extended-context.cjs';
7
- export { A as API_MODE_IDS, a as AgentDefaultModels, b as ApiFormat, c as ApiKeyEntry, d as ApiMode, e as ApiModeId, C as ChatApiFormat, f as CodingPlanConfig, g as CompletionSettings, G as GlobalModelParameters, L as LLMProvider, M as ModelConfig, h as ModelGroup, i as ModelParameter, j as ModelRef, O as OpenRouterDataCollection, k as OpenRouterMaxPrice, l as OpenRouterProviderRouting, m as OpenRouterProviderSort, n as OpenRouterQuantization, P as PresetProviderTemplate, o as ProviderApiType, p as ProviderModelMapping, q as ProviderSearchConfig, r as ProviderTemplate, S as SearchCapability, T as TransformerConfig, s as TransformerEntry } from './llm-config-CQjOimv2.cjs';
9
+ export { HealthReport, HealthStatus, LogFormat, LogLevel, LoggingConfig, healthHttpStatus } from './health-logging-types.cjs';
10
+ export { A as API_MODE_IDS, a as AgentDefaultModels, b as ApiFormat, c as ApiKeyEntry, d as ApiMode, e as ApiModeId, C as ChatApiFormat, f as CodingPlanConfig, g as CompletionSettings, G as GlobalModelParameters, L as LLMProvider, M as ModelConfig, h as ModelGroup, i as ModelParameter, j as ModelRef, O as OpenRouterDataCollection, k as OpenRouterMaxPrice, l as OpenRouterProviderRouting, m as OpenRouterProviderSort, n as OpenRouterQuantization, P as PresetProviderTemplate, o as ProviderApiType, p as ProviderModelMapping, q as ProviderSearchConfig, r as ProviderTemplate, S as SearchCapability, T as TransformerConfig, s as TransformerEntry } from './llm-config-DeWNx1ig.cjs';
8
11
  export { DEFAULT_MCP_SESSION_CONFIG, MCPCallToolResponse, MCPTool, MCPToolResponseContent, McpActionResult, McpDiscoverResult, McpMode, McpServerConfig, McpServerInput, McpServerJsonInput, McpServerList, McpServerRecord, McpServerRemoveInput, McpServerScope, McpServerTransport, McpSessionConfig, McpTestResult, McpToolInfo } from './mcp-types.cjs';
9
12
  export { MessageBlock, MessageBlockBase, MessageBlockType, TextBlock, ThinkingBlock, ToolResultBlock, ToolUseBlock } from './message-blocks.cjs';
10
13
  export { DEFAULT_LITELLM_PRICING_URL, PricingConflict, PricingConflictDecision, PricingEntry, PricingEntryInput, PricingFetchResult, PricingResolution, PricingSource } from './pricing-types.cjs';
11
14
  export { CATALOG_VERSION, CODING_PLAN_URL_PRESETS, DEFAULT_SEED_PRESET_IDS, LLM_PROVIDER_PRESETS, MAX_CONCURRENCY_DEFAULTS, PROVIDER_MODEL_MAPPINGS, PROVIDER_SEARCH_CONFIGS, getAllProviderPresets, getCodingPlanBaseUrl, getPresetById, getPresetRevision, getProviderSearchConfig, resolveFollowProviderModel } from './provider-presets/index.cjs';
15
+ export { SUBSCRIPTION_MODEL_CATALOG, subscriptionProviderHasCatalog } from './subscription-model-catalog.cjs';
12
16
  export { OpenCodeGoModelEntry, OpenCodeGoScenario, OpenCodeGoTokenConfig, OpenCodeGoTokenSanitized, ProviderChannel, SubscriptionListEntry, SubscriptionProviderId, SubscriptionStatusEntry, legacyCliBackendToSubscriptionProvider, subscriptionTargetForSession } from './subscription-types.cjs';
13
17
  export { CANNOT_DISABLE_THINKING_PATTERNS, DEFAULT_MAX_TOKENS, EFFORT_RATIO, REASONING_MODEL_PATTERNS, THINKING_TOKEN_MAP, buildAnthropicThinking, buildGeminiThinkingConfig, buildQwenThinkingConfig, calculateThinkingBudget, canDisableThinking, findTokenLimit, getClaudeMaxTokens, getOpenAIReasoningEffort, isReasoningModel } from './thinking-config.cjs';
14
- export { ApiKeyUsageRow, MessageUsageRow, ModelUsageRow, SessionCacheStats, UsageDateRange, UsageEventInput, UsageEventRecord, UsageQueryParams, UsageTotals } from './usage-stats-types.cjs';
18
+ export { ApiKeyUsageRow, MessageUsageRow, ModelUsageRow, SessionCacheStats, UsageDateRange, UsageEventInput, UsageEventRecord, UsageQueryParams, UsageTimeBucket, UsageTimeSeriesBucket, UsageTotals } from './usage-stats-types.cjs';
15
19
  export { UsageEngineOrigin, UsageTokens } from './usage-types.cjs';
20
+ export { DEFAULT_VOUCHER_CONFIG, VoucherConfig, VoucherCreated, VoucherGrant, VoucherInfo, VoucherRecord, VoucherRedeemResult, VoucherStatus, VoucherType } from './voucher-types.cjs';
21
+ export { SanitizedWebhookConfig, SanitizedWebhookDestination, WEBHOOK_DESTINATION_TYPES, WEBHOOK_EVENT_KINDS, WebhookAnomalyState, WebhookConfig, WebhookDestination, WebhookDestinationType, WebhookEvent, WebhookEventKind, WebhookQuotaScope } from './webhook-types.cjs';
16
22
  export { JinaReaderResponse, WebSearchOptions, WebSearchProviderConfig, WebSearchProviderId, WebSearchProviderType, WebSearchResponse, WebSearchResult, isApiProvider, isLocalProvider } from './websearch-types.cjs';
package/dist/index.d.ts CHANGED
@@ -1,16 +1,22 @@
1
- export { AccountTokensConfig, AuthMethod, ClaudeAuthMethod, ClaudeTokenConfig, CodexTokenConfig, GeminiTokenConfig, OAuthParams, SubscriptionAccountEntry, SubscriptionAccountSanitized, SubscriptionLevel, SyncWarningCode, TokenExchangeRequest, TokenStatus } from './account-tokens-types.js';
1
+ export { AccountClientIdentity, AccountTokensConfig, AuthMethod, ClaudeAuthMethod, ClaudeTokenConfig, CodexTokenConfig, GeminiTokenConfig, OAuthParams, ProxyConfig, SanitizedProxyConfig, SubscriptionAccountEntry, SubscriptionAccountSanitized, SubscriptionLevel, SyncWarningCode, TokenExchangeRequest, TokenStatus } from './account-tokens-types.js';
2
+ export { AuditConfig, AuditQueryResult, AuditRecord, DEFAULT_AUDIT_CONFIG } from './audit-types.js';
3
+ export { BillingConfig, BillingDeliveryStatus, BillingEvent, DEFAULT_BILLING_CONFIG } from './billing-types.js';
2
4
  export { KNOWN_MODELS, KnownModelCapabilities, MODEL_ALIASES, ResolvedModelCapabilities, applyAlias, lookupCanonicalCapabilities, normalizeModelId, resolveModelCapabilities } from './canonical-models.js';
3
5
  export { AnthropicAudioContent, AnthropicChatRequest, AnthropicChatResponse, AnthropicContentPart, AnthropicImageContent, AnthropicMessage, AnthropicSystemContent, AnthropicTextContent, AnthropicThinkingContent, AnthropicTool, AnthropicToolResultContent, AnthropicToolUseContent, AnthropicVideoContent, ConversionConfig, OpenAIChatRequest, OpenAIChatResponse, OpenAIContentPart, OpenAIMessage, OpenAIStreamChunk, OpenAITool, OpenAIToolCall, SimpleChatAudio, SimpleChatImage, SimpleChatMessage, SimpleChatSession, SimpleChatVideo } from './completion-types.js';
4
6
  export { R as ReasoningConfig, T as ThinkLevel, a as ThinkingContent } from './thinking-CBWSLel8.js';
5
7
  export { ResolvedEndpoint, resolveProviderEndpoint } from './endpoint-resolver.js';
6
8
  export { EXTENDED_CONTEXT_CAPABLE_MODELS, isExtendedContextCapable } from './extended-context.js';
7
- export { A as API_MODE_IDS, a as AgentDefaultModels, b as ApiFormat, c as ApiKeyEntry, d as ApiMode, e as ApiModeId, C as ChatApiFormat, f as CodingPlanConfig, g as CompletionSettings, G as GlobalModelParameters, L as LLMProvider, M as ModelConfig, h as ModelGroup, i as ModelParameter, j as ModelRef, O as OpenRouterDataCollection, k as OpenRouterMaxPrice, l as OpenRouterProviderRouting, m as OpenRouterProviderSort, n as OpenRouterQuantization, P as PresetProviderTemplate, o as ProviderApiType, p as ProviderModelMapping, q as ProviderSearchConfig, r as ProviderTemplate, S as SearchCapability, T as TransformerConfig, s as TransformerEntry } from './llm-config-D1jKQLVp.js';
9
+ export { HealthReport, HealthStatus, LogFormat, LogLevel, LoggingConfig, healthHttpStatus } from './health-logging-types.js';
10
+ export { A as API_MODE_IDS, a as AgentDefaultModels, b as ApiFormat, c as ApiKeyEntry, d as ApiMode, e as ApiModeId, C as ChatApiFormat, f as CodingPlanConfig, g as CompletionSettings, G as GlobalModelParameters, L as LLMProvider, M as ModelConfig, h as ModelGroup, i as ModelParameter, j as ModelRef, O as OpenRouterDataCollection, k as OpenRouterMaxPrice, l as OpenRouterProviderRouting, m as OpenRouterProviderSort, n as OpenRouterQuantization, P as PresetProviderTemplate, o as ProviderApiType, p as ProviderModelMapping, q as ProviderSearchConfig, r as ProviderTemplate, S as SearchCapability, T as TransformerConfig, s as TransformerEntry } from './llm-config-CKOaFFdy.js';
8
11
  export { DEFAULT_MCP_SESSION_CONFIG, MCPCallToolResponse, MCPTool, MCPToolResponseContent, McpActionResult, McpDiscoverResult, McpMode, McpServerConfig, McpServerInput, McpServerJsonInput, McpServerList, McpServerRecord, McpServerRemoveInput, McpServerScope, McpServerTransport, McpSessionConfig, McpTestResult, McpToolInfo } from './mcp-types.js';
9
12
  export { MessageBlock, MessageBlockBase, MessageBlockType, TextBlock, ThinkingBlock, ToolResultBlock, ToolUseBlock } from './message-blocks.js';
10
13
  export { DEFAULT_LITELLM_PRICING_URL, PricingConflict, PricingConflictDecision, PricingEntry, PricingEntryInput, PricingFetchResult, PricingResolution, PricingSource } from './pricing-types.js';
11
14
  export { CATALOG_VERSION, CODING_PLAN_URL_PRESETS, DEFAULT_SEED_PRESET_IDS, LLM_PROVIDER_PRESETS, MAX_CONCURRENCY_DEFAULTS, PROVIDER_MODEL_MAPPINGS, PROVIDER_SEARCH_CONFIGS, getAllProviderPresets, getCodingPlanBaseUrl, getPresetById, getPresetRevision, getProviderSearchConfig, resolveFollowProviderModel } from './provider-presets/index.js';
15
+ export { SUBSCRIPTION_MODEL_CATALOG, subscriptionProviderHasCatalog } from './subscription-model-catalog.js';
12
16
  export { OpenCodeGoModelEntry, OpenCodeGoScenario, OpenCodeGoTokenConfig, OpenCodeGoTokenSanitized, ProviderChannel, SubscriptionListEntry, SubscriptionProviderId, SubscriptionStatusEntry, legacyCliBackendToSubscriptionProvider, subscriptionTargetForSession } from './subscription-types.js';
13
17
  export { CANNOT_DISABLE_THINKING_PATTERNS, DEFAULT_MAX_TOKENS, EFFORT_RATIO, REASONING_MODEL_PATTERNS, THINKING_TOKEN_MAP, buildAnthropicThinking, buildGeminiThinkingConfig, buildQwenThinkingConfig, calculateThinkingBudget, canDisableThinking, findTokenLimit, getClaudeMaxTokens, getOpenAIReasoningEffort, isReasoningModel } from './thinking-config.js';
14
- export { ApiKeyUsageRow, MessageUsageRow, ModelUsageRow, SessionCacheStats, UsageDateRange, UsageEventInput, UsageEventRecord, UsageQueryParams, UsageTotals } from './usage-stats-types.js';
18
+ export { ApiKeyUsageRow, MessageUsageRow, ModelUsageRow, SessionCacheStats, UsageDateRange, UsageEventInput, UsageEventRecord, UsageQueryParams, UsageTimeBucket, UsageTimeSeriesBucket, UsageTotals } from './usage-stats-types.js';
15
19
  export { UsageEngineOrigin, UsageTokens } from './usage-types.js';
20
+ export { DEFAULT_VOUCHER_CONFIG, VoucherConfig, VoucherCreated, VoucherGrant, VoucherInfo, VoucherRecord, VoucherRedeemResult, VoucherStatus, VoucherType } from './voucher-types.js';
21
+ export { SanitizedWebhookConfig, SanitizedWebhookDestination, WEBHOOK_DESTINATION_TYPES, WEBHOOK_EVENT_KINDS, WebhookAnomalyState, WebhookConfig, WebhookDestination, WebhookDestinationType, WebhookEvent, WebhookEventKind, WebhookQuotaScope } from './webhook-types.js';
16
22
  export { JinaReaderResponse, WebSearchOptions, WebSearchProviderConfig, WebSearchProviderId, WebSearchProviderType, WebSearchResponse, WebSearchResult, isApiProvider, isLocalProvider } from './websearch-types.js';
package/dist/index.js CHANGED
@@ -1,3 +1,18 @@
1
+ // src/audit-types.ts
2
+ var DEFAULT_AUDIT_CONFIG = {
3
+ enabled: false,
4
+ captureBodies: false,
5
+ maxBodyBytes: 8192,
6
+ retentionDays: 7,
7
+ trustForwardedFor: false
8
+ };
9
+
10
+ // src/billing-types.ts
11
+ var DEFAULT_BILLING_CONFIG = {
12
+ enabled: false,
13
+ maxRetryAgeMs: 24 * 60 * 6e4
14
+ };
15
+
1
16
  // src/canonical-models.ts
2
17
  var OPENAI_MODELS = {
3
18
  "gpt-5.5": { category: "reasoning", contextLength: 105e4, maxTokens: 128e3, reasoning: true, vision: true, functionCall: true, thinkingLevels: ["none", "low", "medium", "high", "xhigh"], thinkingTokenLimit: { min: 0, max: 128e3 } },
@@ -260,6 +275,11 @@ function isExtendedContextCapable(model) {
260
275
  return EXTENDED_CONTEXT_CAPABLE_MODELS.has(model);
261
276
  }
262
277
 
278
+ // src/health-logging-types.ts
279
+ function healthHttpStatus(status) {
280
+ return status === "ok" ? 200 : 503;
281
+ }
282
+
263
283
  // src/mcp-types.ts
264
284
  var DEFAULT_MCP_SESSION_CONFIG = {
265
285
  mode: "auto",
@@ -2397,6 +2417,17 @@ function getProviderSearchConfig(presetId) {
2397
2417
  return PROVIDER_SEARCH_CONFIGS[presetId];
2398
2418
  }
2399
2419
 
2420
+ // src/subscription-model-catalog.ts
2421
+ var SUBSCRIPTION_MODEL_CATALOG = {
2422
+ claude: ["claude-haiku-4-5", "claude-sonnet-5", "claude-opus-5", "claude-fable-5"],
2423
+ codex: ["gpt-5.6-luna", "gpt-5.6-terra", "gpt-5.6-sol"],
2424
+ gemini: [],
2425
+ opencodego: []
2426
+ };
2427
+ function subscriptionProviderHasCatalog(providerId) {
2428
+ return SUBSCRIPTION_MODEL_CATALOG[providerId].length > 0;
2429
+ }
2430
+
2400
2431
  // src/subscription-types.ts
2401
2432
  function legacyCliBackendToSubscriptionProvider(cliBackend) {
2402
2433
  switch (cliBackend) {
@@ -2606,6 +2637,22 @@ function buildQwenThinkingConfig(level, userMaxTokens) {
2606
2637
  };
2607
2638
  }
2608
2639
 
2640
+ // src/voucher-types.ts
2641
+ var DEFAULT_VOUCHER_CONFIG = {
2642
+ enabled: false
2643
+ };
2644
+
2645
+ // src/webhook-types.ts
2646
+ var WEBHOOK_EVENT_KINDS = [
2647
+ "account.recovery",
2648
+ "account.anomaly",
2649
+ "key.quotaWarning",
2650
+ "key.quotaExceeded",
2651
+ "server.error",
2652
+ "test"
2653
+ ];
2654
+ var WEBHOOK_DESTINATION_TYPES = ["custom", "feishu"];
2655
+
2609
2656
  // src/websearch-types.ts
2610
2657
  function isApiProvider(id) {
2611
2658
  return !id.startsWith("local-");
@@ -2618,10 +2665,13 @@ export {
2618
2665
  CANNOT_DISABLE_THINKING_PATTERNS,
2619
2666
  CATALOG_VERSION,
2620
2667
  CODING_PLAN_URL_PRESETS,
2668
+ DEFAULT_AUDIT_CONFIG,
2669
+ DEFAULT_BILLING_CONFIG,
2621
2670
  DEFAULT_LITELLM_PRICING_URL,
2622
2671
  DEFAULT_MAX_TOKENS,
2623
2672
  DEFAULT_MCP_SESSION_CONFIG,
2624
2673
  DEFAULT_SEED_PRESET_IDS,
2674
+ DEFAULT_VOUCHER_CONFIG,
2625
2675
  EFFORT_RATIO,
2626
2676
  EXTENDED_CONTEXT_CAPABLE_MODELS,
2627
2677
  KNOWN_MODELS,
@@ -2631,7 +2681,10 @@ export {
2631
2681
  PROVIDER_MODEL_MAPPINGS,
2632
2682
  PROVIDER_SEARCH_CONFIGS,
2633
2683
  REASONING_MODEL_PATTERNS,
2684
+ SUBSCRIPTION_MODEL_CATALOG,
2634
2685
  THINKING_TOKEN_MAP,
2686
+ WEBHOOK_DESTINATION_TYPES,
2687
+ WEBHOOK_EVENT_KINDS,
2635
2688
  applyAlias,
2636
2689
  buildAnthropicThinking,
2637
2690
  buildGeminiThinkingConfig,
@@ -2646,6 +2699,7 @@ export {
2646
2699
  getPresetById,
2647
2700
  getPresetRevision,
2648
2701
  getProviderSearchConfig,
2702
+ healthHttpStatus,
2649
2703
  isApiProvider,
2650
2704
  isExtendedContextCapable,
2651
2705
  isLocalProvider,
@@ -2656,5 +2710,6 @@ export {
2656
2710
  resolveFollowProviderModel,
2657
2711
  resolveModelCapabilities,
2658
2712
  resolveProviderEndpoint,
2713
+ subscriptionProviderHasCatalog,
2659
2714
  subscriptionTargetForSession
2660
2715
  };
@@ -286,6 +286,14 @@ interface LLMProvider {
286
286
  modelGroups?: ModelGroup[];
287
287
  modelsEndpoint?: string;
288
288
  enabled: boolean;
289
+ /**
290
+ * For `apiFormat: 'anthropic'` providers, authenticate with
291
+ * `Authorization: Bearer <apiKey>` instead of the default `x-api-key` header.
292
+ * Set this for third-party Anthropic-Messages relays that gate on a Bearer
293
+ * token (the native/base header path; the transformer path uses the
294
+ * `UseBearer` transformer option independently).
295
+ */
296
+ useBearer?: boolean;
289
297
  transformer?: TransformerConfig;
290
298
  rerouterEnabled?: boolean;
291
299
  icon?: string;
@@ -294,7 +302,6 @@ interface LLMProvider {
294
302
  defaultSettings?: CompletionSettings;
295
303
  isSystem?: boolean;
296
304
  isOfficial?: boolean;
297
- rateLimit?: number;
298
305
  maxConcurrency?: number;
299
306
  notes?: string;
300
307
  apiVersion?: string;
@@ -286,6 +286,14 @@ interface LLMProvider {
286
286
  modelGroups?: ModelGroup[];
287
287
  modelsEndpoint?: string;
288
288
  enabled: boolean;
289
+ /**
290
+ * For `apiFormat: 'anthropic'` providers, authenticate with
291
+ * `Authorization: Bearer <apiKey>` instead of the default `x-api-key` header.
292
+ * Set this for third-party Anthropic-Messages relays that gate on a Bearer
293
+ * token (the native/base header path; the transformer path uses the
294
+ * `UseBearer` transformer option independently).
295
+ */
296
+ useBearer?: boolean;
289
297
  transformer?: TransformerConfig;
290
298
  rerouterEnabled?: boolean;
291
299
  icon?: string;
@@ -294,7 +302,6 @@ interface LLMProvider {
294
302
  defaultSettings?: CompletionSettings;
295
303
  isSystem?: boolean;
296
304
  isOfficial?: boolean;
297
- rateLimit?: number;
298
305
  maxConcurrency?: number;
299
306
  notes?: string;
300
307
  apiVersion?: string;
@@ -1,2 +1,2 @@
1
1
  import './thinking-CBWSLel8.cjs';
2
- export { a as AgentDefaultModels, b as ApiFormat, c as ApiKeyEntry, C as ChatApiFormat, g as CompletionSettings, G as GlobalModelParameters, L as LLMProvider, M as ModelConfig, h as ModelGroup, i as ModelParameter, j as ModelRef, O as OpenRouterDataCollection, k as OpenRouterMaxPrice, l as OpenRouterProviderRouting, m as OpenRouterProviderSort, n as OpenRouterQuantization, o as ProviderApiType, r as ProviderTemplate, T as TransformerConfig, s as TransformerEntry } from './llm-config-CQjOimv2.cjs';
2
+ export { a as AgentDefaultModels, b as ApiFormat, c as ApiKeyEntry, C as ChatApiFormat, g as CompletionSettings, G as GlobalModelParameters, L as LLMProvider, M as ModelConfig, h as ModelGroup, i as ModelParameter, j as ModelRef, O as OpenRouterDataCollection, k as OpenRouterMaxPrice, l as OpenRouterProviderRouting, m as OpenRouterProviderSort, n as OpenRouterQuantization, o as ProviderApiType, r as ProviderTemplate, T as TransformerConfig, s as TransformerEntry } from './llm-config-DeWNx1ig.cjs';
@@ -1,2 +1,2 @@
1
1
  import './thinking-CBWSLel8.js';
2
- export { a as AgentDefaultModels, b as ApiFormat, c as ApiKeyEntry, C as ChatApiFormat, g as CompletionSettings, G as GlobalModelParameters, L as LLMProvider, M as ModelConfig, h as ModelGroup, i as ModelParameter, j as ModelRef, O as OpenRouterDataCollection, k as OpenRouterMaxPrice, l as OpenRouterProviderRouting, m as OpenRouterProviderSort, n as OpenRouterQuantization, o as ProviderApiType, r as ProviderTemplate, T as TransformerConfig, s as TransformerEntry } from './llm-config-D1jKQLVp.js';
2
+ export { a as AgentDefaultModels, b as ApiFormat, c as ApiKeyEntry, C as ChatApiFormat, g as CompletionSettings, G as GlobalModelParameters, L as LLMProvider, M as ModelConfig, h as ModelGroup, i as ModelParameter, j as ModelRef, O as OpenRouterDataCollection, k as OpenRouterMaxPrice, l as OpenRouterProviderRouting, m as OpenRouterProviderSort, n as OpenRouterQuantization, o as ProviderApiType, r as ProviderTemplate, T as TransformerConfig, s as TransformerEntry } from './llm-config-CKOaFFdy.js';
@@ -1,5 +1,5 @@
1
- import { p as ProviderModelMapping, q as ProviderSearchConfig, P as PresetProviderTemplate } from '../llm-config-CQjOimv2.cjs';
2
- export { A as API_MODE_IDS, d as ApiMode, e as ApiModeId, f as CodingPlanConfig, S as SearchCapability } from '../llm-config-CQjOimv2.cjs';
1
+ import { p as ProviderModelMapping, q as ProviderSearchConfig, P as PresetProviderTemplate } from '../llm-config-DeWNx1ig.cjs';
2
+ export { A as API_MODE_IDS, d as ApiMode, e as ApiModeId, f as CodingPlanConfig, S as SearchCapability } from '../llm-config-DeWNx1ig.cjs';
3
3
  import '../thinking-CBWSLel8.cjs';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { p as ProviderModelMapping, q as ProviderSearchConfig, P as PresetProviderTemplate } from '../llm-config-D1jKQLVp.js';
2
- export { A as API_MODE_IDS, d as ApiMode, e as ApiModeId, f as CodingPlanConfig, S as SearchCapability } from '../llm-config-D1jKQLVp.js';
1
+ import { p as ProviderModelMapping, q as ProviderSearchConfig, P as PresetProviderTemplate } from '../llm-config-CKOaFFdy.js';
2
+ export { A as API_MODE_IDS, d as ApiMode, e as ApiModeId, f as CodingPlanConfig, S as SearchCapability } from '../llm-config-CKOaFFdy.js';
3
3
  import '../thinking-CBWSLel8.js';
4
4
 
5
5
  /**
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/subscription-model-catalog.ts
21
+ var subscription_model_catalog_exports = {};
22
+ __export(subscription_model_catalog_exports, {
23
+ SUBSCRIPTION_MODEL_CATALOG: () => SUBSCRIPTION_MODEL_CATALOG,
24
+ subscriptionProviderHasCatalog: () => subscriptionProviderHasCatalog
25
+ });
26
+ module.exports = __toCommonJS(subscription_model_catalog_exports);
27
+ var SUBSCRIPTION_MODEL_CATALOG = {
28
+ claude: ["claude-haiku-4-5", "claude-sonnet-5", "claude-opus-5", "claude-fable-5"],
29
+ codex: ["gpt-5.6-luna", "gpt-5.6-terra", "gpt-5.6-sol"],
30
+ gemini: [],
31
+ opencodego: []
32
+ };
33
+ function subscriptionProviderHasCatalog(providerId) {
34
+ return SUBSCRIPTION_MODEL_CATALOG[providerId].length > 0;
35
+ }
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ SUBSCRIPTION_MODEL_CATALOG,
39
+ subscriptionProviderHasCatalog
40
+ });
@@ -0,0 +1,34 @@
1
+ import { SubscriptionProviderId } from './subscription-types.cjs';
2
+
3
+ /**
4
+ * subscription-model-catalog — the static model-id catalog each built-in
5
+ * subscription provider exposes on its upstream, used to populate the
6
+ * subscription-mode model pickers in the API Service routing editor.
7
+ *
8
+ * These are the model ids the upstream subscription backend actually accepts
9
+ * (Codex → `chatgpt.com/backend-api/codex/responses`, Claude → Anthropic,
10
+ * etc.). They are maintained by hand against the upstream catalog — same
11
+ * convention as `outbound-api`'s `ENDPOINT_MODEL_KINDS`. The UI carries a
12
+ * mirror pinned by test (it ships as standalone static assets with no
13
+ * contracts runtime dep); update both in lockstep.
14
+ *
15
+ * Ordering is small → large within each provider (matches the editor's
16
+ * picker render order).
17
+ *
18
+ * `gemini` / `opencodego` are intentionally empty for now — their upstream
19
+ * subscription model ids are not yet confirmed; the UI disables model
20
+ * selection for those types until they are filled in (does not block the
21
+ * Claude/Codex paths).
22
+ */
23
+
24
+ /**
25
+ * The model ids each subscription provider serves, small → large.
26
+ *
27
+ * - claude: `claude-haiku-4-5` < `claude-sonnet-5` < `claude-opus-5` < `claude-fable-5`
28
+ * - codex: `gpt-5.6-luna` (nano) < `gpt-5.6-terra` (mini) < `gpt-5.6-sol` (flagship)
29
+ */
30
+ declare const SUBSCRIPTION_MODEL_CATALOG: Record<SubscriptionProviderId, string[]>;
31
+ /** Whether a provider has any cataloged models (drives UI model-picker gating). */
32
+ declare function subscriptionProviderHasCatalog(providerId: SubscriptionProviderId): boolean;
33
+
34
+ export { SUBSCRIPTION_MODEL_CATALOG, subscriptionProviderHasCatalog };
@@ -0,0 +1,34 @@
1
+ import { SubscriptionProviderId } from './subscription-types.js';
2
+
3
+ /**
4
+ * subscription-model-catalog — the static model-id catalog each built-in
5
+ * subscription provider exposes on its upstream, used to populate the
6
+ * subscription-mode model pickers in the API Service routing editor.
7
+ *
8
+ * These are the model ids the upstream subscription backend actually accepts
9
+ * (Codex → `chatgpt.com/backend-api/codex/responses`, Claude → Anthropic,
10
+ * etc.). They are maintained by hand against the upstream catalog — same
11
+ * convention as `outbound-api`'s `ENDPOINT_MODEL_KINDS`. The UI carries a
12
+ * mirror pinned by test (it ships as standalone static assets with no
13
+ * contracts runtime dep); update both in lockstep.
14
+ *
15
+ * Ordering is small → large within each provider (matches the editor's
16
+ * picker render order).
17
+ *
18
+ * `gemini` / `opencodego` are intentionally empty for now — their upstream
19
+ * subscription model ids are not yet confirmed; the UI disables model
20
+ * selection for those types until they are filled in (does not block the
21
+ * Claude/Codex paths).
22
+ */
23
+
24
+ /**
25
+ * The model ids each subscription provider serves, small → large.
26
+ *
27
+ * - claude: `claude-haiku-4-5` < `claude-sonnet-5` < `claude-opus-5` < `claude-fable-5`
28
+ * - codex: `gpt-5.6-luna` (nano) < `gpt-5.6-terra` (mini) < `gpt-5.6-sol` (flagship)
29
+ */
30
+ declare const SUBSCRIPTION_MODEL_CATALOG: Record<SubscriptionProviderId, string[]>;
31
+ /** Whether a provider has any cataloged models (drives UI model-picker gating). */
32
+ declare function subscriptionProviderHasCatalog(providerId: SubscriptionProviderId): boolean;
33
+
34
+ export { SUBSCRIPTION_MODEL_CATALOG, subscriptionProviderHasCatalog };
@@ -0,0 +1,14 @@
1
+ // src/subscription-model-catalog.ts
2
+ var SUBSCRIPTION_MODEL_CATALOG = {
3
+ claude: ["claude-haiku-4-5", "claude-sonnet-5", "claude-opus-5", "claude-fable-5"],
4
+ codex: ["gpt-5.6-luna", "gpt-5.6-terra", "gpt-5.6-sol"],
5
+ gemini: [],
6
+ opencodego: []
7
+ };
8
+ function subscriptionProviderHasCatalog(providerId) {
9
+ return SUBSCRIPTION_MODEL_CATALOG[providerId].length > 0;
10
+ }
11
+ export {
12
+ SUBSCRIPTION_MODEL_CATALOG,
13
+ subscriptionProviderHasCatalog
14
+ };
@@ -1,5 +1,5 @@
1
1
  import { T as ThinkLevel } from './thinking-CBWSLel8.cjs';
2
- import { M as ModelConfig } from './llm-config-CQjOimv2.cjs';
2
+ import { M as ModelConfig } from './llm-config-DeWNx1ig.cjs';
3
3
 
4
4
  /**
5
5
  * thinking-config — dependency-light thinking-budget / reasoning-effort helpers.
@@ -1,5 +1,5 @@
1
1
  import { T as ThinkLevel } from './thinking-CBWSLel8.js';
2
- import { M as ModelConfig } from './llm-config-D1jKQLVp.js';
2
+ import { M as ModelConfig } from './llm-config-CKOaFFdy.js';
3
3
 
4
4
  /**
5
5
  * thinking-config — dependency-light thinking-budget / reasoning-effort helpers.
@@ -70,6 +70,27 @@ interface UsageTotals {
70
70
  /** Number of events contributing to these totals. */
71
71
  eventCount: number;
72
72
  }
73
+ /** Granularity for a usage time-series query. `week` is NOT a bucket — a "week" view is a `day` bucket over a 7-day range. */
74
+ type UsageTimeBucket = 'hour' | 'day' | 'month';
75
+ /**
76
+ * One bucket of a usage time-series (trend chart). Buckets are query-time
77
+ * aggregations over the daemon's LOCAL-time boundaries and every bucket in the
78
+ * requested range is present (empty buckets are zero-filled), ascending by
79
+ * `bucketStartTs`.
80
+ */
81
+ interface UsageTimeSeriesBucket {
82
+ /** Unix-millis of the LOCAL-time bucket boundary (hour start / local midnight / local 1st-of-month). */
83
+ bucketStartTs: number;
84
+ /** Frozen locale-agnostic label from LOCAL parts: hour `MM-DD HH:00`, day `YYYY-MM-DD`, month `YYYY-MM`. */
85
+ label: string;
86
+ /** Event count in the bucket (0 for a zero-filled bucket). */
87
+ requests: number;
88
+ inputTokens: number;
89
+ outputTokens: number;
90
+ cacheReadTokens: number;
91
+ cacheCreationTokens: number;
92
+ costUsd: number;
93
+ }
73
94
  /** One row of the per-model breakdown. */
74
95
  interface ModelUsageRow {
75
96
  providerId: string;
@@ -140,4 +161,4 @@ interface MessageUsageRow {
140
161
  costSavedByCacheUsd: number;
141
162
  }
142
163
 
143
- export type { ApiKeyUsageRow, MessageUsageRow, ModelUsageRow, SessionCacheStats, UsageDateRange, UsageEventInput, UsageEventRecord, UsageQueryParams, UsageTotals };
164
+ export type { ApiKeyUsageRow, MessageUsageRow, ModelUsageRow, SessionCacheStats, UsageDateRange, UsageEventInput, UsageEventRecord, UsageQueryParams, UsageTimeBucket, UsageTimeSeriesBucket, UsageTotals };
@@ -70,6 +70,27 @@ interface UsageTotals {
70
70
  /** Number of events contributing to these totals. */
71
71
  eventCount: number;
72
72
  }
73
+ /** Granularity for a usage time-series query. `week` is NOT a bucket — a "week" view is a `day` bucket over a 7-day range. */
74
+ type UsageTimeBucket = 'hour' | 'day' | 'month';
75
+ /**
76
+ * One bucket of a usage time-series (trend chart). Buckets are query-time
77
+ * aggregations over the daemon's LOCAL-time boundaries and every bucket in the
78
+ * requested range is present (empty buckets are zero-filled), ascending by
79
+ * `bucketStartTs`.
80
+ */
81
+ interface UsageTimeSeriesBucket {
82
+ /** Unix-millis of the LOCAL-time bucket boundary (hour start / local midnight / local 1st-of-month). */
83
+ bucketStartTs: number;
84
+ /** Frozen locale-agnostic label from LOCAL parts: hour `MM-DD HH:00`, day `YYYY-MM-DD`, month `YYYY-MM`. */
85
+ label: string;
86
+ /** Event count in the bucket (0 for a zero-filled bucket). */
87
+ requests: number;
88
+ inputTokens: number;
89
+ outputTokens: number;
90
+ cacheReadTokens: number;
91
+ cacheCreationTokens: number;
92
+ costUsd: number;
93
+ }
73
94
  /** One row of the per-model breakdown. */
74
95
  interface ModelUsageRow {
75
96
  providerId: string;
@@ -140,4 +161,4 @@ interface MessageUsageRow {
140
161
  costSavedByCacheUsd: number;
141
162
  }
142
163
 
143
- export type { ApiKeyUsageRow, MessageUsageRow, ModelUsageRow, SessionCacheStats, UsageDateRange, UsageEventInput, UsageEventRecord, UsageQueryParams, UsageTotals };
164
+ export type { ApiKeyUsageRow, MessageUsageRow, ModelUsageRow, SessionCacheStats, UsageDateRange, UsageEventInput, UsageEventRecord, UsageQueryParams, UsageTimeBucket, UsageTimeSeriesBucket, UsageTotals };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/voucher-types.ts
21
+ var voucher_types_exports = {};
22
+ __export(voucher_types_exports, {
23
+ DEFAULT_VOUCHER_CONFIG: () => DEFAULT_VOUCHER_CONFIG
24
+ });
25
+ module.exports = __toCommonJS(voucher_types_exports);
26
+ var DEFAULT_VOUCHER_CONFIG = {
27
+ enabled: false
28
+ };
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ DEFAULT_VOUCHER_CONFIG
32
+ });