@arabold/docs-mcp-server 3.2.1 → 3.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.
Files changed (33) hide show
  1. package/README.md +67 -114
  2. package/db/migrations/017-add-library-display-name.sql +76 -0
  3. package/db/migrations/018-store-embeddings-as-blobs.sql +56 -0
  4. package/db/migrations/019-tune-indexes.sql +30 -0
  5. package/dist/{HtmlDefuddleMiddleware-Cm0vQDqD.js → HtmlDefuddleMiddleware-BNIv3ibo.js} +2 -4
  6. package/dist/HtmlDefuddleMiddleware-BNIv3ibo.js.map +1 -0
  7. package/{public/assets/index-BHI6XhAh.css → dist/assets/index-BG8UJbPA.css} +1 -1
  8. package/dist/assets/index-JESalFJu.js +70 -0
  9. package/dist/assets/index-JESalFJu.js.map +1 -0
  10. package/dist/index.html +3 -3
  11. package/dist/index.js +1 -1
  12. package/dist/{main-BjEbd9LZ.js → main-BoABX2b0.js} +17932 -15335
  13. package/dist/main-BoABX2b0.js.map +1 -0
  14. package/dist/manifest.json +7 -7
  15. package/dist/string-B3iUfzt2.js +44 -0
  16. package/dist/string-B3iUfzt2.js.map +1 -0
  17. package/dist/utils-CjF4IsxT.js +2 -0
  18. package/dist/{utils-uCqhR-rj.js → utils-DXo1A54z.js} +29 -512
  19. package/dist/utils-DXo1A54z.js.map +1 -0
  20. package/package.json +13 -6
  21. package/{dist/assets/index-BHI6XhAh.css → public/assets/index-BG8UJbPA.css} +1 -1
  22. package/public/assets/index-JESalFJu.js +70 -0
  23. package/public/assets/index-JESalFJu.js.map +1 -0
  24. package/public/index.html +3 -3
  25. package/public/manifest.json +7 -7
  26. package/dist/HtmlDefuddleMiddleware-Cm0vQDqD.js.map +0 -1
  27. package/dist/assets/index-CHvUVvbT.js +0 -70
  28. package/dist/assets/index-CHvUVvbT.js.map +0 -1
  29. package/dist/main-BjEbd9LZ.js.map +0 -1
  30. package/dist/utils-BP4qIXx8.js +0 -2
  31. package/dist/utils-uCqhR-rj.js.map +0 -1
  32. package/public/assets/index-CHvUVvbT.js +0 -70
  33. package/public/assets/index-CHvUVvbT.js.map +0 -1
@@ -1,12 +1,9 @@
1
1
  import { t as normalizeEnvValue } from "./env-DONvEfR5.js";
2
2
  import { r as logger } from "./logger-BBxstTD7.js";
3
- import { randomUUID } from "node:crypto";
4
3
  import fs, { existsSync } from "node:fs";
5
4
  import path from "node:path";
6
5
  import { fileURLToPath } from "node:url";
7
6
  import envPaths from "env-paths";
8
- import { PostHog } from "posthog-node";
9
- import EventEmitter from "node:events";
10
7
  import { chromium } from "playwright";
11
8
  import { execSync } from "node:child_process";
12
9
  import { createInterface } from "node:readline";
@@ -447,479 +444,6 @@ function resolveStorePath(storePath) {
447
444
  return dbDir;
448
445
  }
449
446
  //#endregion
450
- //#region src/telemetry/TelemetryConfig.ts
451
- /**
452
- * Telemetry configuration management for enabling/disabling analytics collection.
453
- * Handles CLI flags, environment variables, and default settings.
454
- */
455
- var TelemetryConfig = class TelemetryConfig {
456
- static instance;
457
- enabled = true;
458
- constructor() {}
459
- isEnabled() {
460
- return this.enabled;
461
- }
462
- setEnabled(enabled) {
463
- this.enabled = enabled;
464
- }
465
- static getInstance() {
466
- if (!TelemetryConfig.instance) TelemetryConfig.instance = new TelemetryConfig();
467
- return TelemetryConfig.instance;
468
- }
469
- };
470
- /**
471
- * Generate or retrieve a persistent installation identifier.
472
- * Creates a UUID and stores it in a file in the user data directory.
473
- * Supports custom store path override for Docker deployments.
474
- * This ensures truly unique identification that persists across runs.
475
- */
476
- function generateInstallationId(storePath) {
477
- try {
478
- const dataDir = resolveStorePath(storePath);
479
- const installationIdPath = path.join(dataDir, "installation.id");
480
- if (fs.existsSync(installationIdPath)) {
481
- const existingId = fs.readFileSync(installationIdPath, "utf8").trim();
482
- if (existingId) return existingId;
483
- }
484
- const newId = randomUUID();
485
- fs.mkdirSync(dataDir, { recursive: true });
486
- fs.writeFileSync(installationIdPath, newId, "utf8");
487
- return newId;
488
- } catch {
489
- return randomUUID();
490
- }
491
- }
492
- /**
493
- * Check if telemetry should be enabled based on environment and CLI flags.
494
- */
495
- function shouldEnableTelemetry() {
496
- return TelemetryConfig.getInstance().isEnabled();
497
- }
498
- //#endregion
499
- //#region src/events/types.ts
500
- /**
501
- * Event type enum used by the EventBusService.
502
- * These are the internal event identifiers.
503
- */
504
- var EventType = /* @__PURE__ */ function(EventType) {
505
- EventType["JOB_STATUS_CHANGE"] = "JOB_STATUS_CHANGE";
506
- EventType["JOB_PROGRESS"] = "JOB_PROGRESS";
507
- EventType["LIBRARY_CHANGE"] = "LIBRARY_CHANGE";
508
- EventType["JOB_LIST_CHANGE"] = "JOB_LIST_CHANGE";
509
- return EventType;
510
- }({});
511
- //#endregion
512
- //#region src/pipeline/types.ts
513
- /**
514
- * Represents the possible states of a pipeline job.
515
- */
516
- var PipelineJobStatus = /* @__PURE__ */ function(PipelineJobStatus) {
517
- PipelineJobStatus["QUEUED"] = "queued";
518
- PipelineJobStatus["RUNNING"] = "running";
519
- PipelineJobStatus["COMPLETED"] = "completed";
520
- PipelineJobStatus["FAILED"] = "failed";
521
- PipelineJobStatus["CANCELLING"] = "cancelling";
522
- PipelineJobStatus["CANCELLED"] = "cancelled";
523
- return PipelineJobStatus;
524
- }({});
525
- //#endregion
526
- //#region src/telemetry/postHogClient.ts
527
- /**
528
- * PostHog client wrapper for telemetry events.
529
- * Handles PostHog SDK integration and event capture with privacy-first configuration.
530
- * Automatically converts camelCase property names to snake_case for PostHog compatibility.
531
- */
532
- /**
533
- * Convert camelCase string to snake_case
534
- * Specifically designed for PostHog property name conversion
535
- */
536
- function camelToSnakeCase(str) {
537
- return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
538
- }
539
- /**
540
- * Recursively convert object keys from camelCase to snake_case
541
- * Handles nested objects and arrays while preserving values
542
- */
543
- function convertPropertiesToSnakeCase(obj) {
544
- const result = {};
545
- for (const [key, value] of Object.entries(obj)) {
546
- const snakeKey = camelToSnakeCase(key);
547
- if (value && typeof value === "object" && !Array.isArray(value) && !(value instanceof Date)) result[snakeKey] = convertPropertiesToSnakeCase(value);
548
- else if (Array.isArray(value)) result[snakeKey] = value.map((item) => item && typeof item === "object" && !(item instanceof Date) ? convertPropertiesToSnakeCase(item) : item);
549
- else result[snakeKey] = value;
550
- }
551
- return result;
552
- }
553
- /**
554
- * Add PostHog standard properties and remove duplicates
555
- * Maps our properties to PostHog's expected property names
556
- */
557
- function addPostHogStandardProperties(properties) {
558
- const result = { ...properties };
559
- if (properties.sessionId) {
560
- result.$session_id = properties.sessionId;
561
- delete result.sessionId;
562
- }
563
- if (properties.startTime) {
564
- result.$start_timestamp = properties.startTime.toISOString();
565
- delete result.startTime;
566
- }
567
- if (properties.appVersion) {
568
- result.$app_version = properties.appVersion;
569
- delete result.appVersion;
570
- }
571
- return result;
572
- }
573
- /**
574
- * PostHog client wrapper for telemetry events
575
- */
576
- var PostHogClient = class PostHogClient {
577
- client;
578
- enabled;
579
- static CONFIG = {
580
- host: "https://app.posthog.com",
581
- flushAt: 20,
582
- flushInterval: 1e4,
583
- disableGeoip: true,
584
- disableSessionRecording: true,
585
- disableSurveys: true,
586
- persistence: "memory"
587
- };
588
- constructor(enabled) {
589
- this.enabled = enabled;
590
- if (!this.enabled) return;
591
- try {
592
- this.client = new PostHog("phc_g7pXZZdUiAQXdnwUANjloQWMvO0amEDTBaeDSWgXgrQ", {
593
- host: PostHogClient.CONFIG.host,
594
- flushAt: PostHogClient.CONFIG.flushAt,
595
- flushInterval: PostHogClient.CONFIG.flushInterval,
596
- disableGeoip: PostHogClient.CONFIG.disableGeoip
597
- });
598
- logger.debug("PostHog client initialized");
599
- } catch (error) {
600
- logger.debug(`PostHog initialization failed: ${error instanceof Error ? error.message : "Unknown error"}`);
601
- this.enabled = false;
602
- }
603
- }
604
- /**
605
- * Send event to PostHog
606
- */
607
- capture(distinctId, event, properties) {
608
- if (!this.enabled || !this.client) return;
609
- try {
610
- const snakeCaseProperties = convertPropertiesToSnakeCase(addPostHogStandardProperties(properties));
611
- this.client.capture({
612
- distinctId,
613
- event,
614
- properties: snakeCaseProperties
615
- });
616
- logger.debug(`PostHog event captured: ${event}`);
617
- } catch (error) {
618
- logger.debug(`PostHog capture error: ${error instanceof Error ? error.message : "Unknown error"}`);
619
- }
620
- }
621
- /**
622
- * Capture exception using PostHog's native error tracking
623
- */
624
- captureException(distinctId, error, properties) {
625
- if (!this.enabled || !this.client) return;
626
- try {
627
- const snakeCaseProperties = convertPropertiesToSnakeCase(addPostHogStandardProperties(properties || {}));
628
- this.client.captureException({
629
- error,
630
- distinctId,
631
- properties: snakeCaseProperties
632
- });
633
- logger.debug(`PostHog exception captured: ${error.constructor.name}`);
634
- } catch (captureError) {
635
- logger.debug(`PostHog captureException error: ${captureError instanceof Error ? captureError.message : "Unknown error"}`);
636
- }
637
- }
638
- /**
639
- * Graceful shutdown with event flushing
640
- */
641
- async shutdown() {
642
- if (this.client) try {
643
- await this.client.shutdown();
644
- logger.debug("PostHog client shutdown complete");
645
- } catch (error) {
646
- logger.debug(`PostHog shutdown error: ${error instanceof Error ? error.message : "Unknown error"}`);
647
- }
648
- }
649
- /**
650
- * Check if client is enabled and ready
651
- */
652
- isEnabled() {
653
- return this.enabled && !!this.client;
654
- }
655
- };
656
- //#endregion
657
- //#region src/telemetry/telemetry.ts
658
- /**
659
- * Telemtry wrapper for privacy-first telemetry using PostHog.
660
- * Provides global context and automatic data sanitization.
661
- *
662
- * Architecture:
663
- * - PostHogClient: Handles PostHog SDK integration and event capture
664
- * - Telemtry: High-level coordinator providing public API with global context
665
- */
666
- /**
667
- * Event types for structured telemetry tracking
668
- */
669
- var TelemetryEvent = /* @__PURE__ */ function(TelemetryEvent) {
670
- TelemetryEvent["APP_STARTED"] = "app_started";
671
- TelemetryEvent["APP_SHUTDOWN"] = "app_shutdown";
672
- TelemetryEvent["CLI_COMMAND"] = "cli_command";
673
- TelemetryEvent["TOOL_USED"] = "tool_used";
674
- TelemetryEvent["PIPELINE_JOB_STARTED"] = "pipeline_job_started";
675
- TelemetryEvent["PIPELINE_JOB_COMPLETED"] = "pipeline_job_completed";
676
- TelemetryEvent["PIPELINE_JOB_FAILED"] = "pipeline_job_failed";
677
- return TelemetryEvent;
678
- }({});
679
- /**
680
- * Main telemetry class providing privacy-first telemetry
681
- */
682
- var Telemetry = class Telemetry {
683
- postHogClient;
684
- enabled;
685
- distinctId;
686
- globalContext = {};
687
- /**
688
- * Create a new Telemetry instance with proper initialization
689
- * This is the recommended way to create Telemetry instances
690
- */
691
- static create() {
692
- const config = TelemetryConfig.getInstance();
693
- const shouldEnable = config.isEnabled() && true;
694
- const telemetry = new Telemetry(shouldEnable);
695
- if (telemetry.isEnabled()) logger.debug("Telemetry enabled");
696
- else if (!config.isEnabled()) logger.debug("Telemetry disabled (user preference)");
697
- else logger.debug("Telemetry disabled");
698
- return telemetry;
699
- }
700
- /**
701
- * Private constructor - use Telemetry.create() instead
702
- */
703
- constructor(enabled = true) {
704
- this.enabled = enabled;
705
- this.distinctId = generateInstallationId();
706
- this.postHogClient = new PostHogClient(this.enabled);
707
- }
708
- /**
709
- * Set global application context that will be included in all events
710
- */
711
- setGlobalContext(context) {
712
- this.globalContext = { ...context };
713
- }
714
- /**
715
- * Get current global context
716
- */
717
- getGlobalContext() {
718
- return { ...this.globalContext };
719
- }
720
- track(event, properties = {}) {
721
- if (!this.enabled) return;
722
- const enrichedProperties = {
723
- ...this.globalContext,
724
- ...properties,
725
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
726
- };
727
- logger.debug(`Tracking event: ${event}`);
728
- this.postHogClient.capture(this.distinctId, event, enrichedProperties);
729
- }
730
- /**
731
- * Capture exception using PostHog's native error tracking with global context
732
- */
733
- captureException(error, properties = {}) {
734
- if (!this.enabled) return;
735
- const enrichedProperties = {
736
- ...this.globalContext,
737
- ...properties,
738
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
739
- };
740
- logger.debug(`Capturing exception: ${error instanceof Error ? error.message : String(error)}`);
741
- this.postHogClient.captureException(this.distinctId, error instanceof Error ? error : new Error(String(error)), enrichedProperties);
742
- }
743
- /**
744
- * Graceful shutdown with event flushing
745
- */
746
- async shutdown() {
747
- if (!this.enabled) return;
748
- await this.postHogClient.shutdown();
749
- }
750
- /**
751
- * Check if telemetry is enabled
752
- */
753
- isEnabled() {
754
- return this.enabled;
755
- }
756
- };
757
- /**
758
- * Global telemetry instance - initialized lazily
759
- */
760
- var telemetryInstance = null;
761
- /**
762
- * Get the global telemetry instance, initializing it if needed
763
- */
764
- function getTelemetryInstance() {
765
- if (!telemetryInstance) telemetryInstance = Telemetry.create();
766
- return telemetryInstance;
767
- }
768
- /**
769
- * Initialize telemetry system with proper configuration.
770
- * This should be called once at application startup.
771
- */
772
- function initTelemetry(options) {
773
- TelemetryConfig.getInstance().setEnabled(options.enabled);
774
- generateInstallationId(options.storePath);
775
- telemetryInstance = Telemetry.create();
776
- }
777
- var telemetry = new Proxy({}, { get(_target, prop) {
778
- const instance = getTelemetryInstance();
779
- const value = instance[prop];
780
- if (typeof value === "function") return value.bind(instance);
781
- return value;
782
- } });
783
- //#endregion
784
- //#region src/telemetry/TelemetryService.ts
785
- var TelemetryService = class {
786
- eventBus;
787
- unsubscribers = [];
788
- constructor(eventBus) {
789
- this.eventBus = eventBus;
790
- this.setupEventListeners();
791
- }
792
- /**
793
- * Sets up event listeners for pipeline events.
794
- */
795
- setupEventListeners() {
796
- const unsubStatusChange = this.eventBus.on(EventType.JOB_STATUS_CHANGE, this.handleJobStatusChange.bind(this));
797
- const unsubProgress = this.eventBus.on(EventType.JOB_PROGRESS, this.handleJobProgress.bind(this));
798
- this.unsubscribers.push(unsubStatusChange, unsubProgress);
799
- logger.debug("TelemetryService initialized and listening to events");
800
- }
801
- /**
802
- * Handles job status change events and tracks them to analytics.
803
- * Only tracks events for meaningful state transitions: started, completed, and failed.
804
- */
805
- handleJobStatusChange(job) {
806
- const duration = job.startedAt ? Date.now() - job.startedAt.getTime() : null;
807
- const queueWaitTime = job.startedAt && job.createdAt ? job.startedAt.getTime() - job.createdAt.getTime() : null;
808
- switch (job.status) {
809
- case PipelineJobStatus.RUNNING:
810
- telemetry.track(TelemetryEvent.PIPELINE_JOB_STARTED, {
811
- jobId: job.id,
812
- library: job.library,
813
- hasVersion: !!job.version,
814
- maxPagesConfigured: job.scraperOptions?.maxPages ?? null,
815
- queueWaitTimeMs: queueWaitTime
816
- });
817
- break;
818
- case PipelineJobStatus.COMPLETED:
819
- telemetry.track(TelemetryEvent.PIPELINE_JOB_COMPLETED, {
820
- jobId: job.id,
821
- library: job.library,
822
- durationMs: duration,
823
- pagesProcessed: job.progressPages || 0,
824
- maxPagesConfigured: job.scraperOptions?.maxPages ?? null,
825
- hasVersion: !!job.version,
826
- throughputPagesPerSecond: duration && job.progressPages ? Math.round(job.progressPages / duration * 1e3) : 0
827
- });
828
- break;
829
- case PipelineJobStatus.FAILED:
830
- telemetry.track(TelemetryEvent.PIPELINE_JOB_FAILED, {
831
- jobId: job.id,
832
- library: job.library,
833
- durationMs: duration,
834
- pagesProcessed: job.progressPages || 0,
835
- maxPagesConfigured: job.scraperOptions?.maxPages ?? null,
836
- hasVersion: !!job.version,
837
- hasError: !!job.error,
838
- errorMessage: job.error?.message
839
- });
840
- break;
841
- default: break;
842
- }
843
- }
844
- /**
845
- * Handles job progress events. Currently a no-op but can be extended
846
- * for progress-specific telemetry tracking.
847
- */
848
- handleJobProgress(_event) {}
849
- /**
850
- * Cleans up event listeners.
851
- */
852
- shutdown() {
853
- for (const unsubscribe of this.unsubscribers) unsubscribe();
854
- this.unsubscribers = [];
855
- logger.debug("TelemetryService shut down");
856
- }
857
- };
858
- //#endregion
859
- //#region src/events/EventBusService.ts
860
- /**
861
- * Central event bus service for application-wide event distribution.
862
- *
863
- * This service provides a pub/sub mechanism that can be used by any service
864
- * to emit and listen for events. Events emitted here can be:
865
- * - Consumed locally by in-process subscribers
866
- * - Broadcast to remote processes via tRPC subscriptions
867
- * - Forwarded to SSE clients via the web service
868
- *
869
- * This decouples event producers (like DocumentManagementService) from
870
- * consumers (like the Web UI), enabling a clean, scalable architecture.
871
- */
872
- /**
873
- * Central event bus for application-wide events.
874
- */
875
- var EventBusService = class {
876
- emitter;
877
- constructor() {
878
- this.emitter = new EventEmitter();
879
- this.emitter.setMaxListeners(100);
880
- }
881
- /**
882
- * Emit an event to all subscribers.
883
- */
884
- emit(eventType, payload) {
885
- logger.debug(`Event emitted: ${eventType}`);
886
- this.emitter.emit(eventType, payload);
887
- }
888
- /**
889
- * Subscribe to events of a specific type.
890
- * Returns an unsubscribe function.
891
- */
892
- on(eventType, listener) {
893
- this.emitter.on(eventType, listener);
894
- return () => this.emitter.off(eventType, listener);
895
- }
896
- /**
897
- * Subscribe to events once (auto-unsubscribes after first event).
898
- */
899
- once(eventType, listener) {
900
- this.emitter.once(eventType, listener);
901
- }
902
- /**
903
- * Remove a specific listener.
904
- */
905
- off(eventType, listener) {
906
- this.emitter.off(eventType, listener);
907
- }
908
- /**
909
- * Remove all listeners for a specific event type, or all listeners if no type specified.
910
- */
911
- removeAllListeners(eventType) {
912
- if (eventType === void 0) this.emitter.removeAllListeners();
913
- else this.emitter.removeAllListeners(eventType);
914
- }
915
- /**
916
- * Get the count of listeners for a specific event type.
917
- */
918
- listenerCount(eventType) {
919
- return this.emitter.listenerCount(eventType);
920
- }
921
- };
922
- //#endregion
923
447
  //#region src/cli/utils.ts
924
448
  /**
925
449
  * Shared CLI utilities and helper functions.
@@ -1012,15 +536,17 @@ function validateHost(hostString) {
1012
536
  *
1013
537
  * AppConfig is the source of truth for host/auth/telemetry/read-only settings.
1014
538
  * AppServerConfig only selects which services to run and which port to bind to.
539
+ * Whether the server runs jobs itself or uses a worker follows from the backend.
540
+ *
541
+ * @param options Which services to run, the port, and startup details.
542
+ * @returns The server configuration.
1015
543
  */
1016
544
  function createAppServerConfig(options) {
1017
545
  return {
1018
546
  enableWebInterface: options.enableWebInterface ?? false,
1019
547
  enableMcpServer: options.enableMcpServer ?? true,
1020
548
  enableApiServer: options.enableApiServer ?? false,
1021
- enableWorker: options.enableWorker ?? true,
1022
549
  port: options.port,
1023
- externalWorkerUrl: options.externalWorkerUrl,
1024
550
  showLogo: options.showLogo ?? true,
1025
551
  startupContext: options.startupContext
1026
552
  };
@@ -1041,33 +567,37 @@ function parseHeaders(headerOptions) {
1041
567
  return headers;
1042
568
  }
1043
569
  /**
1044
- * Parses auth configuration from CLI options.
1045
- * Environment variables are handled by createOptionWithEnv in command definitions.
1046
- * Precedence: CLI flags > env vars (handled by commander) > defaults
1047
- */
1048
- function parseAuthConfig(options) {
1049
- if (!options.authEnabled) return;
1050
- return {
1051
- enabled: true,
1052
- issuerUrl: options.authIssuerUrl,
1053
- audience: options.authAudience,
1054
- scopes: ["openid", "profile"]
1055
- };
570
+ * Check the auth settings for the transport a command serves. Authentication
571
+ * applies to MCP over HTTP only. Over stdio the host launching the process is
572
+ * the trust boundary, so auth settings are ignored with a warning on stderr,
573
+ * which never carries protocol data.
574
+ * @param auth - The loaded auth settings.
575
+ * @param protocol - The resolved transport.
576
+ * @param port - The HTTP port, for the plain-HTTP warning.
577
+ * @throws Error when an auth setting over HTTP is malformed.
578
+ */
579
+ function checkAuthForProtocol(auth, protocol, port) {
580
+ if (!auth.enabled) return;
581
+ if (protocol === "stdio") {
582
+ console.error("⚠️ Authentication does not apply to MCP over stdio; auth settings are ignored.");
583
+ return;
584
+ }
585
+ validateAuthConfig(auth);
586
+ warnHttpUsage(port);
1056
587
  }
1057
588
  /**
1058
- * Validates auth configuration when auth is enabled.
589
+ * Validates the format of auth settings that are present. Whether a setting
590
+ * is required depends on what the process serves, so the server checks that
591
+ * at startup.
1059
592
  */
1060
593
  function validateAuthConfig(authConfig) {
1061
- if (!authConfig.enabled) return;
1062
594
  const errors = [];
1063
- if (!authConfig.issuerUrl) errors.push("--auth-issuer-url is required when auth is enabled");
1064
- else try {
595
+ if (authConfig.issuerUrl) try {
1065
596
  if (new URL(authConfig.issuerUrl).protocol !== "https:") errors.push("Issuer URL must use HTTPS protocol");
1066
597
  } catch {
1067
598
  errors.push("Issuer URL must be a valid URL");
1068
599
  }
1069
- if (!authConfig.audience) errors.push("--auth-audience is required when auth is enabled");
1070
- else try {
600
+ if (authConfig.audience) try {
1071
601
  const url = new URL(authConfig.audience);
1072
602
  if (url.protocol === "http:" && url.hostname !== "localhost") logger.warn("⚠️ Audience uses HTTP protocol - consider using HTTPS for production");
1073
603
  if (url.hash) errors.push("Audience must not contain URL fragments");
@@ -1082,23 +612,10 @@ function validateAuthConfig(authConfig) {
1082
612
  /**
1083
613
  * Warns about HTTP usage in production when auth is enabled.
1084
614
  */
1085
- function warnHttpUsage(authConfig, port) {
1086
- if (!authConfig?.enabled) return;
615
+ function warnHttpUsage(port) {
1087
616
  if (!(process.env.NODE_ENV !== "production" || port === 6280 || process.env.HOSTNAME?.includes("localhost"))) logger.warn("⚠️ Authentication is enabled but running over HTTP in production. Consider using HTTPS for security.");
1088
617
  }
1089
618
  /**
1090
- * Creates EventBusService and TelemetryService together.
1091
- * The TelemetryService automatically subscribes to events from the EventBusService.
1092
- * @returns Object containing both services
1093
- */
1094
- function createEventServices() {
1095
- const eventBus = new EventBusService();
1096
- return {
1097
- eventBus,
1098
- telemetryService: new TelemetryService(eventBus)
1099
- };
1100
- }
1101
- /**
1102
619
  * Resolves embedding configuration from the provided model specification.
1103
620
  * This function centralizes the logic for determining the embedding model.
1104
621
  *
@@ -1153,6 +670,6 @@ async function handleEmbeddingModelChange(error, service) {
1153
670
  await service.resolveModelChange();
1154
671
  }
1155
672
  //#endregion
1156
- export { shouldEnableTelemetry as C, SUPPORTED_PROVIDERS as D, EmbeddingConfig as E, splitModelSpec as O, EventType as S, resolveStorePath as T, TelemetryService as _, getGlobalOptions as a, telemetry as b, parseHeaders as c, validateAuthConfig as d, validateHost as f, EventBusService as g, warnHttpUsage as h, getEventBus as i, resolveEmbeddingContext as l, validateResumeFlag as m, createEventServices as n, handleEmbeddingModelChange as o, validatePort as p, ensurePlaywrightBrowsersInstalled as r, parseAuthConfig as s, createAppServerConfig as t, resolveProtocol as u, TelemetryEvent as v, getProjectRoot as w, PipelineJobStatus as x, initTelemetry as y };
673
+ export { splitModelSpec as _, getGlobalOptions as a, resolveEmbeddingContext as c, validatePort as d, validateResumeFlag as f, SUPPORTED_PROVIDERS as g, EmbeddingConfig as h, getEventBus as i, resolveProtocol as l, resolveStorePath as m, createAppServerConfig as n, handleEmbeddingModelChange as o, getProjectRoot as p, ensurePlaywrightBrowsersInstalled as r, parseHeaders as s, checkAuthForProtocol as t, validateHost as u };
1157
674
 
1158
- //# sourceMappingURL=utils-uCqhR-rj.js.map
675
+ //# sourceMappingURL=utils-DXo1A54z.js.map