@dotsetlabs/bellwether 2.1.1 → 2.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +19 -4
  3. package/dist/baseline/golden-output.d.ts +0 -4
  4. package/dist/baseline/golden-output.js +2 -47
  5. package/dist/cli/commands/baseline-accept.js +14 -45
  6. package/dist/cli/commands/baseline.js +23 -78
  7. package/dist/cli/commands/check-formatters.d.ts +10 -0
  8. package/dist/cli/commands/check-formatters.js +160 -0
  9. package/dist/cli/commands/check.js +48 -213
  10. package/dist/cli/commands/contract.js +1 -13
  11. package/dist/cli/commands/dashboard.d.ts +3 -0
  12. package/dist/cli/commands/dashboard.js +69 -0
  13. package/dist/cli/commands/discover.js +24 -2
  14. package/dist/cli/commands/explore.js +34 -38
  15. package/dist/cli/commands/watch.js +14 -4
  16. package/dist/cli/output.d.ts +0 -42
  17. package/dist/cli/output.js +73 -110
  18. package/dist/cli/utils/config-loader.d.ts +6 -0
  19. package/dist/cli/utils/config-loader.js +19 -0
  20. package/dist/cli/utils/error-hints.d.ts +9 -0
  21. package/dist/cli/utils/error-hints.js +128 -0
  22. package/dist/cli/utils/headers.d.ts +12 -0
  23. package/dist/cli/utils/headers.js +40 -0
  24. package/dist/cli/utils/path-resolution.d.ts +10 -0
  25. package/dist/cli/utils/path-resolution.js +27 -0
  26. package/dist/cli/utils/report-loader.d.ts +9 -0
  27. package/dist/cli/utils/report-loader.js +31 -0
  28. package/dist/cli/utils/server-runtime.d.ts +16 -0
  29. package/dist/cli/utils/server-runtime.js +31 -0
  30. package/dist/config/defaults.d.ts +2 -1
  31. package/dist/config/defaults.js +2 -1
  32. package/dist/config/template.js +12 -0
  33. package/dist/config/validator.d.ts +38 -18
  34. package/dist/config/validator.js +10 -0
  35. package/dist/constants/core.d.ts +2 -42
  36. package/dist/constants/core.js +11 -50
  37. package/dist/contract/validator.js +2 -47
  38. package/dist/dashboard/index.d.ts +3 -0
  39. package/dist/dashboard/index.js +6 -0
  40. package/dist/dashboard/runtime/artifact-index.d.ts +45 -0
  41. package/dist/dashboard/runtime/artifact-index.js +238 -0
  42. package/dist/dashboard/runtime/command-profiles.d.ts +764 -0
  43. package/dist/dashboard/runtime/command-profiles.js +691 -0
  44. package/dist/dashboard/runtime/config-service.d.ts +21 -0
  45. package/dist/dashboard/runtime/config-service.js +73 -0
  46. package/dist/dashboard/runtime/job-runner.d.ts +26 -0
  47. package/dist/dashboard/runtime/job-runner.js +292 -0
  48. package/dist/dashboard/security/input-validation.d.ts +3 -0
  49. package/dist/dashboard/security/input-validation.js +27 -0
  50. package/dist/dashboard/security/localhost-guard.d.ts +5 -0
  51. package/dist/dashboard/security/localhost-guard.js +52 -0
  52. package/dist/dashboard/server.d.ts +14 -0
  53. package/dist/dashboard/server.js +293 -0
  54. package/dist/dashboard/types.d.ts +55 -0
  55. package/dist/dashboard/types.js +2 -0
  56. package/dist/dashboard/ui.d.ts +2 -0
  57. package/dist/dashboard/ui.js +2264 -0
  58. package/dist/discovery/discovery.js +20 -1
  59. package/dist/discovery/types.d.ts +1 -1
  60. package/dist/docs/contract.js +7 -1
  61. package/dist/errors/retry.js +15 -1
  62. package/dist/errors/types.d.ts +10 -0
  63. package/dist/errors/types.js +28 -0
  64. package/dist/interview/question-category.d.ts +5 -0
  65. package/dist/interview/question-category.js +2 -0
  66. package/dist/interview/question-types.d.ts +80 -0
  67. package/dist/interview/question-types.js +2 -0
  68. package/dist/interview/schema-test-generator.d.ts +3 -29
  69. package/dist/interview/schema-test-generator.js +11 -286
  70. package/dist/interview/test-fixtures.d.ts +19 -0
  71. package/dist/interview/test-fixtures.js +2 -0
  72. package/dist/interview/types.d.ts +5 -80
  73. package/dist/persona/types.d.ts +3 -5
  74. package/dist/scenarios/types.d.ts +1 -1
  75. package/dist/transport/auth-errors.d.ts +15 -0
  76. package/dist/transport/auth-errors.js +22 -0
  77. package/dist/transport/http-transport.js +8 -0
  78. package/dist/transport/mcp-client.d.ts +12 -0
  79. package/dist/transport/mcp-client.js +92 -4
  80. package/dist/transport/sse-transport.d.ts +0 -1
  81. package/dist/transport/sse-transport.js +15 -11
  82. package/dist/utils/content-type.d.ts +14 -0
  83. package/dist/utils/content-type.js +37 -0
  84. package/dist/utils/http-headers.d.ts +9 -0
  85. package/dist/utils/http-headers.js +34 -0
  86. package/dist/utils/smart-truncate.js +2 -23
  87. package/package.json +4 -15
  88. package/man/bellwether.1 +0 -204
  89. package/man/bellwether.1.md +0 -148
@@ -0,0 +1,31 @@
1
+ import { existsSync, readFileSync } from 'fs';
2
+ const DEFAULT_MISSING_REPORT_MESSAGE = 'Run `bellwether check` first with JSON output enabled.\n' +
3
+ 'Configure in bellwether.yaml:\n' +
4
+ ' output:\n' +
5
+ ' format: json # or "both" for JSON + markdown';
6
+ /**
7
+ * Load a check-mode interview report from JSON.
8
+ */
9
+ export function loadCheckInterviewResult(reportPath, options) {
10
+ if (!existsSync(reportPath)) {
11
+ throw new Error(`Test report not found: ${reportPath}\n\n${options?.missingReportMessage ?? DEFAULT_MISSING_REPORT_MESSAGE}`);
12
+ }
13
+ const content = readFileSync(reportPath, 'utf-8');
14
+ let result;
15
+ try {
16
+ result = JSON.parse(content);
17
+ }
18
+ catch (error) {
19
+ throw new Error(`Invalid JSON in report file ${reportPath}: ${error instanceof Error ? error.message : 'Unknown error'}`);
20
+ }
21
+ if (result.metadata.model && result.metadata.model !== 'check') {
22
+ if (options?.invalidModeMessage) {
23
+ throw new Error(options.invalidModeMessage(result.metadata.model));
24
+ }
25
+ throw new Error(`Baseline operations only work with check mode results.\n\n` +
26
+ `The report at ${reportPath} was created with explore mode (model: ${result.metadata.model}).\n` +
27
+ 'Run `bellwether check` to generate a check mode report first.');
28
+ }
29
+ return result;
30
+ }
31
+ //# sourceMappingURL=report-loader.js.map
@@ -0,0 +1,16 @@
1
+ import { type BellwetherConfig } from '../../config/loader.js';
2
+ import type { TransportType } from '../../transport/base-transport.js';
3
+ export interface ResolvedServerRuntime {
4
+ serverCommand: string;
5
+ args: string[];
6
+ transport: TransportType;
7
+ remoteUrl?: string;
8
+ remoteSessionId?: string;
9
+ remoteHeaders?: Record<string, string>;
10
+ serverIdentifier: string;
11
+ }
12
+ /**
13
+ * Resolve server command, args, transport, and headers from config + CLI inputs.
14
+ */
15
+ export declare function resolveServerRuntime(config: BellwetherConfig, serverCommandArg: string | undefined, serverArgs: string[], headerValues?: string[]): ResolvedServerRuntime;
16
+ //# sourceMappingURL=server-runtime.d.ts.map
@@ -0,0 +1,31 @@
1
+ import { parseCommandString, } from '../../config/loader.js';
2
+ import { mergeHeaders, parseCliHeaders } from './headers.js';
3
+ /**
4
+ * Resolve server command, args, transport, and headers from config + CLI inputs.
5
+ */
6
+ export function resolveServerRuntime(config, serverCommandArg, serverArgs, headerValues) {
7
+ const serverConfig = config.server;
8
+ let serverCommand = serverCommandArg || serverConfig.command;
9
+ let args = serverArgs.length > 0 ? serverArgs : serverConfig.args;
10
+ if (!serverCommandArg && args.length === 0 && serverCommand.includes(' ')) {
11
+ const parsed = parseCommandString(serverCommand);
12
+ serverCommand = parsed.command;
13
+ args = parsed.args;
14
+ }
15
+ const transport = (serverConfig.transport ?? 'stdio');
16
+ const remoteUrl = serverConfig.url?.trim();
17
+ const remoteSessionId = serverConfig.sessionId?.trim();
18
+ const cliHeaders = parseCliHeaders(headerValues);
19
+ const remoteHeaders = mergeHeaders(serverConfig.headers, cliHeaders);
20
+ const serverIdentifier = transport === 'stdio' ? `${serverCommand} ${args.join(' ')}`.trim() : (remoteUrl ?? 'unknown');
21
+ return {
22
+ serverCommand,
23
+ args,
24
+ transport,
25
+ remoteUrl: remoteUrl || undefined,
26
+ remoteSessionId: remoteSessionId || undefined,
27
+ remoteHeaders,
28
+ serverIdentifier,
29
+ };
30
+ }
31
+ //# sourceMappingURL=server-runtime.js.map
@@ -6,6 +6,7 @@ export declare const CONFIG_DEFAULTS: {
6
6
  readonly transport: "stdio";
7
7
  readonly url: "";
8
8
  readonly sessionId: "";
9
+ readonly headers: Record<string, string> | undefined;
9
10
  };
10
11
  readonly llm: {
11
12
  readonly provider: "ollama";
@@ -100,7 +101,6 @@ export declare const CONFIG_DEFAULTS: {
100
101
  };
101
102
  readonly baseline: {
102
103
  readonly path: "bellwether-baseline.json";
103
- readonly savePath: ".bellwether/bellwether-baseline.json";
104
104
  readonly failOnDrift: false;
105
105
  readonly outputFormat: "text";
106
106
  readonly severity: {
@@ -128,6 +128,7 @@ export declare const CONFIG_DEFAULTS: {
128
128
  readonly transport: "stdio";
129
129
  readonly url: "";
130
130
  readonly sessionId: "";
131
+ readonly headers: Record<string, string> | undefined;
131
132
  };
132
133
  readonly registry: {
133
134
  readonly limit: 10;
@@ -8,6 +8,7 @@ export const CONFIG_DEFAULTS = {
8
8
  transport: 'stdio',
9
9
  url: '',
10
10
  sessionId: '',
11
+ headers: undefined,
11
12
  },
12
13
  llm: {
13
14
  provider: 'ollama',
@@ -109,7 +110,6 @@ export const CONFIG_DEFAULTS = {
109
110
  },
110
111
  baseline: {
111
112
  path: PATHS.DEFAULT_BASELINE_FILE,
112
- savePath: '.bellwether/bellwether-baseline.json',
113
113
  failOnDrift: false,
114
114
  outputFormat: 'text',
115
115
  severity: {
@@ -137,6 +137,7 @@ export const CONFIG_DEFAULTS = {
137
137
  transport: 'stdio',
138
138
  url: '',
139
139
  sessionId: '',
140
+ headers: undefined,
140
141
  },
141
142
  registry: {
142
143
  limit: 10,
@@ -55,6 +55,12 @@ server:
55
55
  # Session ID for remote authentication (optional)
56
56
  # sessionId: "your-session-id"
57
57
 
58
+ # Custom headers for remote server authentication
59
+ # Headers support \${VAR} environment variable interpolation
60
+ # headers:
61
+ # Authorization: "Bearer \${MCP_SERVER_TOKEN}"
62
+ # X-API-Key: "\${MCP_API_KEY}"
63
+
58
64
  # Timeout for server startup and tool calls (milliseconds, default: ${defaults.server.timeout})
59
65
  timeout: ${defaults.server.timeout}
60
66
 
@@ -388,6 +394,12 @@ discovery:
388
394
  # Session ID for remote server authentication
389
395
  # sessionId: "session-id"
390
396
 
397
+ # Custom headers for remote server authentication
398
+ # Headers support \${VAR} environment variable interpolation
399
+ # headers:
400
+ # Authorization: "Bearer \${MCP_SERVER_TOKEN}"
401
+ # X-API-Key: "\${MCP_API_KEY}"
402
+
391
403
  # =============================================================================
392
404
  # REGISTRY COMMAND SETTINGS
393
405
  # =============================================================================
@@ -23,6 +23,8 @@ export declare const serverConfigSchema: z.ZodDefault<z.ZodObject<{
23
23
  sessionId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
24
24
  /** Additional environment variables */
25
25
  env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
26
+ /** Custom headers for remote server authentication */
27
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
26
28
  }, "strip", z.ZodTypeAny, {
27
29
  command: string;
28
30
  args: string[];
@@ -30,6 +32,7 @@ export declare const serverConfigSchema: z.ZodDefault<z.ZodObject<{
30
32
  timeout: number;
31
33
  sessionId: string;
32
34
  url: string;
35
+ headers?: Record<string, string> | undefined;
33
36
  env?: Record<string, string> | undefined;
34
37
  }, {
35
38
  command?: string | undefined;
@@ -37,6 +40,7 @@ export declare const serverConfigSchema: z.ZodDefault<z.ZodObject<{
37
40
  transport?: "stdio" | "sse" | "streamable-http" | undefined;
38
41
  timeout?: number | undefined;
39
42
  sessionId?: string | undefined;
43
+ headers?: Record<string, string> | undefined;
40
44
  url?: string | undefined;
41
45
  env?: Record<string, string> | undefined;
42
46
  }>>;
@@ -73,19 +77,19 @@ export declare const llmConfigSchema: z.ZodDefault<z.ZodObject<{
73
77
  /** Environment variable for Anthropic API key */
74
78
  anthropicApiKeyEnvVar: z.ZodOptional<z.ZodString>;
75
79
  }, "strip", z.ZodTypeAny, {
80
+ provider: "openai" | "anthropic" | "ollama";
81
+ model: string;
76
82
  ollama: {
77
83
  baseUrl: string;
78
84
  };
79
- model: string;
80
- provider: "openai" | "anthropic" | "ollama";
81
85
  openaiApiKeyEnvVar?: string | undefined;
82
86
  anthropicApiKeyEnvVar?: string | undefined;
83
87
  }, {
88
+ provider?: "openai" | "anthropic" | "ollama" | undefined;
89
+ model?: string | undefined;
84
90
  ollama?: {
85
91
  baseUrl?: string | undefined;
86
92
  } | undefined;
87
- model?: string | undefined;
88
- provider?: "openai" | "anthropic" | "ollama" | undefined;
89
93
  openaiApiKeyEnvVar?: string | undefined;
90
94
  anthropicApiKeyEnvVar?: string | undefined;
91
95
  }>>;
@@ -877,25 +881,25 @@ export declare const baselineConfigSchema: z.ZodDefault<z.ZodObject<{
877
881
  aspectOverrides?: Partial<Record<"error_handling" | "resource" | "server" | "security" | "response_format" | "response_structure" | "response_schema_evolution" | "error_pattern" | "performance" | "schema" | "description" | "prompt" | "capability", "none" | "info" | "warning" | "breaking">> | undefined;
878
882
  }>>;
879
883
  }, "strip", z.ZodTypeAny, {
880
- path: string;
881
884
  severity: {
882
885
  minimumSeverity: "none" | "info" | "warning" | "breaking";
883
886
  failOnSeverity: "none" | "info" | "warning" | "breaking";
884
887
  suppressWarnings: boolean;
885
888
  aspectOverrides?: Partial<Record<"error_handling" | "resource" | "server" | "security" | "response_format" | "response_structure" | "response_schema_evolution" | "error_pattern" | "performance" | "schema" | "description" | "prompt" | "capability", "none" | "info" | "warning" | "breaking">> | undefined;
886
889
  };
890
+ path: string;
887
891
  failOnDrift: boolean;
888
892
  outputFormat: "text" | "json" | "markdown" | "compact";
889
893
  savePath?: string | undefined;
890
894
  comparePath?: string | undefined;
891
895
  }, {
892
- path?: string | undefined;
893
896
  severity?: {
894
897
  minimumSeverity?: "none" | "info" | "warning" | "breaking" | undefined;
895
898
  failOnSeverity?: "none" | "info" | "warning" | "breaking" | undefined;
896
899
  suppressWarnings?: boolean | undefined;
897
900
  aspectOverrides?: Partial<Record<"error_handling" | "resource" | "server" | "security" | "response_format" | "response_structure" | "response_schema_evolution" | "error_pattern" | "performance" | "schema" | "description" | "prompt" | "capability", "none" | "info" | "warning" | "breaking">> | undefined;
898
901
  } | undefined;
902
+ path?: string | undefined;
899
903
  savePath?: string | undefined;
900
904
  comparePath?: string | undefined;
901
905
  failOnDrift?: boolean | undefined;
@@ -968,16 +972,20 @@ export declare const discoveryConfigSchema: z.ZodDefault<z.ZodObject<{
968
972
  url: z.ZodDefault<z.ZodOptional<z.ZodString>>;
969
973
  /** Session ID for remote auth */
970
974
  sessionId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
975
+ /** Custom headers for remote server authentication */
976
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
971
977
  }, "strip", z.ZodTypeAny, {
972
978
  transport: "stdio" | "sse" | "streamable-http";
973
979
  timeout: number;
974
980
  sessionId: string;
975
981
  url: string;
976
982
  json: boolean;
983
+ headers?: Record<string, string> | undefined;
977
984
  }, {
978
985
  transport?: "stdio" | "sse" | "streamable-http" | undefined;
979
986
  timeout?: number | undefined;
980
987
  sessionId?: string | undefined;
988
+ headers?: Record<string, string> | undefined;
981
989
  url?: string | undefined;
982
990
  json?: boolean | undefined;
983
991
  }>>;
@@ -1077,6 +1085,8 @@ export declare const bellwetherConfigSchema: z.ZodObject<{
1077
1085
  sessionId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1078
1086
  /** Additional environment variables */
1079
1087
  env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1088
+ /** Custom headers for remote server authentication */
1089
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1080
1090
  }, "strip", z.ZodTypeAny, {
1081
1091
  command: string;
1082
1092
  args: string[];
@@ -1084,6 +1094,7 @@ export declare const bellwetherConfigSchema: z.ZodObject<{
1084
1094
  timeout: number;
1085
1095
  sessionId: string;
1086
1096
  url: string;
1097
+ headers?: Record<string, string> | undefined;
1087
1098
  env?: Record<string, string> | undefined;
1088
1099
  }, {
1089
1100
  command?: string | undefined;
@@ -1091,6 +1102,7 @@ export declare const bellwetherConfigSchema: z.ZodObject<{
1091
1102
  transport?: "stdio" | "sse" | "streamable-http" | undefined;
1092
1103
  timeout?: number | undefined;
1093
1104
  sessionId?: string | undefined;
1105
+ headers?: Record<string, string> | undefined;
1094
1106
  url?: string | undefined;
1095
1107
  env?: Record<string, string> | undefined;
1096
1108
  }>>;
@@ -1114,19 +1126,19 @@ export declare const bellwetherConfigSchema: z.ZodObject<{
1114
1126
  /** Environment variable for Anthropic API key */
1115
1127
  anthropicApiKeyEnvVar: z.ZodOptional<z.ZodString>;
1116
1128
  }, "strip", z.ZodTypeAny, {
1129
+ provider: "openai" | "anthropic" | "ollama";
1130
+ model: string;
1117
1131
  ollama: {
1118
1132
  baseUrl: string;
1119
1133
  };
1120
- model: string;
1121
- provider: "openai" | "anthropic" | "ollama";
1122
1134
  openaiApiKeyEnvVar?: string | undefined;
1123
1135
  anthropicApiKeyEnvVar?: string | undefined;
1124
1136
  }, {
1137
+ provider?: "openai" | "anthropic" | "ollama" | undefined;
1138
+ model?: string | undefined;
1125
1139
  ollama?: {
1126
1140
  baseUrl?: string | undefined;
1127
1141
  } | undefined;
1128
- model?: string | undefined;
1129
- provider?: "openai" | "anthropic" | "ollama" | undefined;
1130
1142
  openaiApiKeyEnvVar?: string | undefined;
1131
1143
  anthropicApiKeyEnvVar?: string | undefined;
1132
1144
  }>>;
@@ -1629,25 +1641,25 @@ export declare const bellwetherConfigSchema: z.ZodObject<{
1629
1641
  aspectOverrides?: Partial<Record<"error_handling" | "resource" | "server" | "security" | "response_format" | "response_structure" | "response_schema_evolution" | "error_pattern" | "performance" | "schema" | "description" | "prompt" | "capability", "none" | "info" | "warning" | "breaking">> | undefined;
1630
1642
  }>>;
1631
1643
  }, "strip", z.ZodTypeAny, {
1632
- path: string;
1633
1644
  severity: {
1634
1645
  minimumSeverity: "none" | "info" | "warning" | "breaking";
1635
1646
  failOnSeverity: "none" | "info" | "warning" | "breaking";
1636
1647
  suppressWarnings: boolean;
1637
1648
  aspectOverrides?: Partial<Record<"error_handling" | "resource" | "server" | "security" | "response_format" | "response_structure" | "response_schema_evolution" | "error_pattern" | "performance" | "schema" | "description" | "prompt" | "capability", "none" | "info" | "warning" | "breaking">> | undefined;
1638
1649
  };
1650
+ path: string;
1639
1651
  failOnDrift: boolean;
1640
1652
  outputFormat: "text" | "json" | "markdown" | "compact";
1641
1653
  savePath?: string | undefined;
1642
1654
  comparePath?: string | undefined;
1643
1655
  }, {
1644
- path?: string | undefined;
1645
1656
  severity?: {
1646
1657
  minimumSeverity?: "none" | "info" | "warning" | "breaking" | undefined;
1647
1658
  failOnSeverity?: "none" | "info" | "warning" | "breaking" | undefined;
1648
1659
  suppressWarnings?: boolean | undefined;
1649
1660
  aspectOverrides?: Partial<Record<"error_handling" | "resource" | "server" | "security" | "response_format" | "response_structure" | "response_schema_evolution" | "error_pattern" | "performance" | "schema" | "description" | "prompt" | "capability", "none" | "info" | "warning" | "breaking">> | undefined;
1650
1661
  } | undefined;
1662
+ path?: string | undefined;
1651
1663
  savePath?: string | undefined;
1652
1664
  comparePath?: string | undefined;
1653
1665
  failOnDrift?: boolean | undefined;
@@ -1712,16 +1724,20 @@ export declare const bellwetherConfigSchema: z.ZodObject<{
1712
1724
  url: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1713
1725
  /** Session ID for remote auth */
1714
1726
  sessionId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1727
+ /** Custom headers for remote server authentication */
1728
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1715
1729
  }, "strip", z.ZodTypeAny, {
1716
1730
  transport: "stdio" | "sse" | "streamable-http";
1717
1731
  timeout: number;
1718
1732
  sessionId: string;
1719
1733
  url: string;
1720
1734
  json: boolean;
1735
+ headers?: Record<string, string> | undefined;
1721
1736
  }, {
1722
1737
  transport?: "stdio" | "sse" | "streamable-http" | undefined;
1723
1738
  timeout?: number | undefined;
1724
1739
  sessionId?: string | undefined;
1740
+ headers?: Record<string, string> | undefined;
1725
1741
  url?: string | undefined;
1726
1742
  json?: boolean | undefined;
1727
1743
  }>>;
@@ -1800,6 +1816,7 @@ export declare const bellwetherConfigSchema: z.ZodObject<{
1800
1816
  timeout: number;
1801
1817
  sessionId: string;
1802
1818
  url: string;
1819
+ headers?: Record<string, string> | undefined;
1803
1820
  env?: Record<string, string> | undefined;
1804
1821
  };
1805
1822
  discovery: {
@@ -1808,6 +1825,7 @@ export declare const bellwetherConfigSchema: z.ZodObject<{
1808
1825
  sessionId: string;
1809
1826
  url: string;
1810
1827
  json: boolean;
1828
+ headers?: Record<string, string> | undefined;
1811
1829
  };
1812
1830
  check: {
1813
1831
  security: {
@@ -1906,11 +1924,11 @@ export declare const bellwetherConfigSchema: z.ZodObject<{
1906
1924
  path?: string | undefined;
1907
1925
  };
1908
1926
  llm: {
1927
+ provider: "openai" | "anthropic" | "ollama";
1928
+ model: string;
1909
1929
  ollama: {
1910
1930
  baseUrl: string;
1911
1931
  };
1912
- model: string;
1913
- provider: "openai" | "anthropic" | "ollama";
1914
1932
  openaiApiKeyEnvVar?: string | undefined;
1915
1933
  anthropicApiKeyEnvVar?: string | undefined;
1916
1934
  };
@@ -1919,13 +1937,13 @@ export declare const bellwetherConfigSchema: z.ZodObject<{
1919
1937
  path?: string | undefined;
1920
1938
  };
1921
1939
  baseline: {
1922
- path: string;
1923
1940
  severity: {
1924
1941
  minimumSeverity: "none" | "info" | "warning" | "breaking";
1925
1942
  failOnSeverity: "none" | "info" | "warning" | "breaking";
1926
1943
  suppressWarnings: boolean;
1927
1944
  aspectOverrides?: Partial<Record<"error_handling" | "resource" | "server" | "security" | "response_format" | "response_structure" | "response_schema_evolution" | "error_pattern" | "performance" | "schema" | "description" | "prompt" | "capability", "none" | "info" | "warning" | "breaking">> | undefined;
1928
1945
  };
1946
+ path: string;
1929
1947
  failOnDrift: boolean;
1930
1948
  outputFormat: "text" | "json" | "markdown" | "compact";
1931
1949
  savePath?: string | undefined;
@@ -1967,6 +1985,7 @@ export declare const bellwetherConfigSchema: z.ZodObject<{
1967
1985
  transport?: "stdio" | "sse" | "streamable-http" | undefined;
1968
1986
  timeout?: number | undefined;
1969
1987
  sessionId?: string | undefined;
1988
+ headers?: Record<string, string> | undefined;
1970
1989
  url?: string | undefined;
1971
1990
  env?: Record<string, string> | undefined;
1972
1991
  } | undefined;
@@ -1974,6 +1993,7 @@ export declare const bellwetherConfigSchema: z.ZodObject<{
1974
1993
  transport?: "stdio" | "sse" | "streamable-http" | undefined;
1975
1994
  timeout?: number | undefined;
1976
1995
  sessionId?: string | undefined;
1996
+ headers?: Record<string, string> | undefined;
1977
1997
  url?: string | undefined;
1978
1998
  json?: boolean | undefined;
1979
1999
  } | undefined;
@@ -2074,11 +2094,11 @@ export declare const bellwetherConfigSchema: z.ZodObject<{
2074
2094
  autoGenerate?: boolean | undefined;
2075
2095
  } | undefined;
2076
2096
  llm?: {
2097
+ provider?: "openai" | "anthropic" | "ollama" | undefined;
2098
+ model?: string | undefined;
2077
2099
  ollama?: {
2078
2100
  baseUrl?: string | undefined;
2079
2101
  } | undefined;
2080
- model?: string | undefined;
2081
- provider?: "openai" | "anthropic" | "ollama" | undefined;
2082
2102
  openaiApiKeyEnvVar?: string | undefined;
2083
2103
  anthropicApiKeyEnvVar?: string | undefined;
2084
2104
  } | undefined;
@@ -2087,13 +2107,13 @@ export declare const bellwetherConfigSchema: z.ZodObject<{
2087
2107
  only?: boolean | undefined;
2088
2108
  } | undefined;
2089
2109
  baseline?: {
2090
- path?: string | undefined;
2091
2110
  severity?: {
2092
2111
  minimumSeverity?: "none" | "info" | "warning" | "breaking" | undefined;
2093
2112
  failOnSeverity?: "none" | "info" | "warning" | "breaking" | undefined;
2094
2113
  suppressWarnings?: boolean | undefined;
2095
2114
  aspectOverrides?: Partial<Record<"error_handling" | "resource" | "server" | "security" | "response_format" | "response_structure" | "response_schema_evolution" | "error_pattern" | "performance" | "schema" | "description" | "prompt" | "capability", "none" | "info" | "warning" | "breaking">> | undefined;
2096
2115
  } | undefined;
2116
+ path?: string | undefined;
2097
2117
  savePath?: string | undefined;
2098
2118
  comparePath?: string | undefined;
2099
2119
  failOnDrift?: boolean | undefined;
@@ -36,6 +36,8 @@ export const serverConfigSchema = z
36
36
  sessionId: z.string().optional().default(CONFIG_DEFAULTS.server.sessionId),
37
37
  /** Additional environment variables */
38
38
  env: z.record(z.string()).optional(),
39
+ /** Custom headers for remote server authentication */
40
+ headers: z.record(z.string()).optional(),
39
41
  })
40
42
  .default(CONFIG_DEFAULTS.server);
41
43
  /**
@@ -593,6 +595,8 @@ export const discoveryConfigSchema = z
593
595
  url: z.string().optional().default(CONFIG_DEFAULTS.discovery.url),
594
596
  /** Session ID for remote auth */
595
597
  sessionId: z.string().optional().default(CONFIG_DEFAULTS.discovery.sessionId),
598
+ /** Custom headers for remote server authentication */
599
+ headers: z.record(z.string()).optional(),
596
600
  })
597
601
  .default(CONFIG_DEFAULTS.discovery);
598
602
  /**
@@ -723,6 +727,12 @@ export function getConfigWarnings(config) {
723
727
  warnings.push('External services mode is set to "fail" but no credentials detected');
724
728
  }
725
729
  }
730
+ if ((config.server.transport ?? 'stdio') === 'stdio' && config.server.headers) {
731
+ warnings.push('server.headers is set but ignored when server.transport is stdio');
732
+ }
733
+ if ((config.discovery.transport ?? 'stdio') === 'stdio' && config.discovery.headers) {
734
+ warnings.push('discovery.headers is set but ignored when discovery.transport is stdio');
735
+ }
726
736
  return warnings;
727
737
  }
728
738
  /**
@@ -49,6 +49,8 @@ export declare const TRANSPORT_ERRORS: {
49
49
  readonly BUFFER_OVERFLOW_PATTERNS: readonly RegExp[];
50
50
  /** Patterns indicating connection refusal */
51
51
  readonly CONNECTION_REFUSED_PATTERNS: readonly RegExp[];
52
+ /** Patterns indicating remote authentication/authorization failures */
53
+ readonly AUTH_FAILURE_PATTERNS: readonly RegExp[];
52
54
  /** Patterns indicating connection was lost */
53
55
  readonly CONNECTION_LOST_PATTERNS: readonly RegExp[];
54
56
  /** Patterns indicating MCP protocol violations */
@@ -61,8 +63,6 @@ export declare const TRANSPORT_ERRORS: {
61
63
  readonly MAX_ERRORS_TO_COLLECT: 50;
62
64
  /** Error messages that indicate a likely server bug (vs environment issue) */
63
65
  readonly SERVER_BUG_INDICATORS: readonly RegExp[];
64
- /** Error messages that indicate environment/config issues */
65
- readonly ENVIRONMENT_ISSUE_INDICATORS: readonly RegExp[];
66
66
  };
67
67
  /**
68
68
  * Interview process configuration defaults.
@@ -506,46 +506,6 @@ export declare const CLI_SECURITY: {
506
506
  /**
507
507
  * External service URLs.
508
508
  */
509
- export declare const TOKEN_ESTIMATION: {
510
- /** Average input tokens per question */
511
- readonly AVG_INPUT_PER_QUESTION: 500;
512
- /** Average output tokens per question */
513
- readonly AVG_OUTPUT_PER_QUESTION: 300;
514
- /** Schema overhead tokens per tool */
515
- readonly SCHEMA_OVERHEAD_PER_TOOL: 200;
516
- /** Character to token ratio (approximate) */
517
- readonly CHARS_PER_TOKEN: 4;
518
- /** Word adjustment factor */
519
- readonly WORD_ADJUSTMENT: 0.3;
520
- /** Role/message overhead tokens */
521
- readonly MESSAGE_OVERHEAD_TOKENS: 4;
522
- /** Default context window when model unknown */
523
- readonly DEFAULT_CONTEXT_WINDOW: 16000;
524
- };
525
- /**
526
- * Default token budget limits.
527
- */
528
- export declare const TOKEN_BUDGET: {
529
- /** Maximum total tokens for an interview */
530
- readonly MAX_TOTAL_TOKENS: 1000000;
531
- /** Maximum input tokens per request */
532
- readonly MAX_INPUT_PER_REQUEST: 100000;
533
- /** Maximum output tokens per request */
534
- readonly MAX_OUTPUT_PER_REQUEST: 8000;
535
- /** Reserved tokens for output in context */
536
- readonly OUTPUT_RESERVE: 4000;
537
- };
538
- /**
539
- * Metrics collection configuration.
540
- */
541
- export declare const METRICS_CONFIG: {
542
- /** Maximum entries in metrics store */
543
- readonly MAX_ENTRIES: 10000;
544
- /** Latency histogram buckets (ms) */
545
- readonly LATENCY_BUCKETS: readonly [10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000];
546
- /** Metric name prefix */
547
- readonly PREFIX: "bellwether_";
548
- };
549
509
  /**
550
510
  * Default model configurations per provider.
551
511
  * Uses budget-friendly, non-reasoning models by default for cost efficiency.
@@ -71,6 +71,17 @@ export const TRANSPORT_ERRORS = {
71
71
  /cannot find module/i,
72
72
  /not found/i,
73
73
  ],
74
+ /** Patterns indicating remote authentication/authorization failures */
75
+ AUTH_FAILURE_PATTERNS: [
76
+ /\b401\b/i,
77
+ /\b403\b/i,
78
+ /\b407\b/i,
79
+ /unauthorized/i,
80
+ /forbidden/i,
81
+ /authentication/i,
82
+ /authorization/i,
83
+ /access denied/i,
84
+ ],
74
85
  /** Patterns indicating connection was lost */
75
86
  CONNECTION_LOST_PATTERNS: [
76
87
  /ECONNRESET/i,
@@ -101,14 +112,6 @@ export const TRANSPORT_ERRORS = {
101
112
  /protocol.*error/i,
102
113
  /invalid.*response/i,
103
114
  ],
104
- /** Error messages that indicate environment/config issues */
105
- ENVIRONMENT_ISSUE_INDICATORS: [
106
- /ENOENT/i,
107
- /not found/i,
108
- /permission denied/i,
109
- /EACCES/i,
110
- /cannot find module/i,
111
- ],
112
115
  };
113
116
  // ==================== Interview Configuration ====================
114
117
  /**
@@ -578,48 +581,6 @@ export const CLI_SECURITY = {
578
581
  /**
579
582
  * External service URLs.
580
583
  */
581
- export const TOKEN_ESTIMATION = {
582
- /** Average input tokens per question */
583
- AVG_INPUT_PER_QUESTION: 500,
584
- /** Average output tokens per question */
585
- AVG_OUTPUT_PER_QUESTION: 300,
586
- /** Schema overhead tokens per tool */
587
- SCHEMA_OVERHEAD_PER_TOOL: 200,
588
- /** Character to token ratio (approximate) */
589
- CHARS_PER_TOKEN: 4,
590
- /** Word adjustment factor */
591
- WORD_ADJUSTMENT: 0.3,
592
- /** Role/message overhead tokens */
593
- MESSAGE_OVERHEAD_TOKENS: 4,
594
- /** Default context window when model unknown */
595
- DEFAULT_CONTEXT_WINDOW: 16000,
596
- };
597
- // ==================== Token Budget ====================
598
- /**
599
- * Default token budget limits.
600
- */
601
- export const TOKEN_BUDGET = {
602
- /** Maximum total tokens for an interview */
603
- MAX_TOTAL_TOKENS: 1000000,
604
- /** Maximum input tokens per request */
605
- MAX_INPUT_PER_REQUEST: 100000,
606
- /** Maximum output tokens per request */
607
- MAX_OUTPUT_PER_REQUEST: 8000,
608
- /** Reserved tokens for output in context */
609
- OUTPUT_RESERVE: 4000,
610
- };
611
- // ==================== Metrics ====================
612
- /**
613
- * Metrics collection configuration.
614
- */
615
- export const METRICS_CONFIG = {
616
- /** Maximum entries in metrics store */
617
- MAX_ENTRIES: 10000,
618
- /** Latency histogram buckets (ms) */
619
- LATENCY_BUCKETS: [10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000],
620
- /** Metric name prefix */
621
- PREFIX: 'bellwether_',
622
- };
623
584
  // ==================== LLM Models ====================
624
585
  /**
625
586
  * Default model configurations per provider.