global.d.ts 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /**
  2. * Global declarations for compile-time macros and internal-only identifiers
  3. * that are eliminated via Bun's MACRO/bundle feature system.
  4. */
  5. // ============================================================================
  6. // MACRO — Bun compile-time constants injected via bunfig.toml [define] (dev)
  7. // and Bun.build({ define }) (production). See bunfig.toml & build.ts.
  8. declare namespace MACRO {
  9. export const VERSION: string
  10. export const BUILD_TIME: string
  11. export const FEEDBACK_CHANNEL: string
  12. export const ISSUES_EXPLAINER: string
  13. export const NATIVE_PACKAGE_URL: string
  14. export const PACKAGE_URL: string
  15. export const VERSION_CHANGELOG: string
  16. }
  17. // ============================================================================
  18. // Internal Anthropic-only identifiers (dead-code eliminated in open-source)
  19. // These are referenced inside `MACRO(() => ...)` or `false && ...` blocks.
  20. // Model resolution (internal)
  21. declare function resolveAntModel(model: string): import('../utils/model/antModels.js').AntModel | undefined
  22. declare function getAntModels(): import('../utils/model/antModels.js').AntModel[]
  23. declare function getAntModelOverrideConfig(): {
  24. defaultSystemPromptSuffix?: string
  25. [key: string]: unknown
  26. } | null
  27. // Companion/buddy observer (internal)
  28. declare function fireCompanionObserver(
  29. messages: unknown[],
  30. callback: (reaction: unknown) => void,
  31. ): void
  32. // Metrics (internal)
  33. type ApiMetricEntry = { ttftMs: number; firstTokenTime: number; lastTokenTime: number; responseLengthBaseline: number; endResponseLength: number }
  34. declare const apiMetricsRef: React.RefObject<ApiMetricEntry[]> | null
  35. declare function computeTtftText(metrics: ApiMetricEntry[]): string
  36. // Gate/feature system (internal)
  37. declare const Gates: Record<string, boolean>
  38. declare function GateOverridesWarning(): JSX.Element | null
  39. declare function ExperimentEnrollmentNotice(): JSX.Element | null
  40. // Hook timing threshold (re-exported from services/tools/toolExecution.ts)
  41. declare const HOOK_TIMING_DISPLAY_THRESHOLD_MS: number
  42. // Ultraplan (internal)
  43. declare function UltraplanChoiceDialog(props: Record<string, unknown>): JSX.Element | null
  44. declare function UltraplanLaunchDialog(props: Record<string, unknown>): JSX.Element | null
  45. declare function launchUltraplan(...args: unknown[]): Promise<string>
  46. // T — Generic type parameter leaked from React compiler output
  47. // (react/compiler-runtime emits compiled JSX that loses generic type params)
  48. declare type T = unknown
  49. // Tungsten (internal)
  50. declare function TungstenPill(props?: { key?: string; selected?: boolean }): JSX.Element | null
  51. // ============================================================================
  52. // Build-time constants BUILD_TARGET/BUILD_ENV/INTERFACE_TYPE — removed (zero runtime usage)
  53. // ============================================================================
  54. // Ink custom JSX intrinsic elements — see src/types/ink-jsx.d.ts
  55. // ============================================================================
  56. // Bun text/file loaders — allow importing non-TS assets as strings
  57. declare module '*.md' {
  58. const content: string
  59. export default content
  60. }
  61. declare module '*.txt' {
  62. const content: string
  63. export default content
  64. }
  65. declare module '*.html' {
  66. const content: string
  67. export default content
  68. }
  69. declare module '*.css' {
  70. const content: string
  71. export default content
  72. }