@databricks/appkit-ui 0.90.0 → 0.91.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +8 -0
- package/dist/cli/commands/agent/eval.js +18 -2
- package/dist/cli/commands/agent/eval.js.map +1 -1
- package/dist/cli/commands/doctor/bundle.js +10 -1
- package/dist/cli/commands/doctor/bundle.js.map +1 -1
- package/dist/cli/commands/doctor/checks-wiring.js +1 -1
- package/dist/cli/commands/doctor/checks-wiring.js.map +1 -1
- package/dist/cli/commands/doctor/databricks-client.js +8 -3
- package/dist/cli/commands/doctor/databricks-client.js.map +1 -1
- package/dist/cli/commands/doctor/run.js +1 -1
- package/dist/cli/commands/doctor/run.js.map +1 -1
- package/dist/react/charts/area/index.d.ts.map +1 -1
- package/dist/react/charts/area/index.js.map +1 -1
- package/dist/react/charts/bar/index.d.ts.map +1 -1
- package/dist/react/charts/bar/index.js.map +1 -1
- package/dist/react/charts/heatmap/index.d.ts.map +1 -1
- package/dist/react/charts/heatmap/index.js.map +1 -1
- package/dist/react/charts/line/index.d.ts.map +1 -1
- package/dist/react/charts/line/index.js.map +1 -1
- package/dist/react/charts/pie/index.d.ts.map +1 -1
- package/dist/react/charts/pie/index.js.map +1 -1
- package/dist/react/charts/radar/index.d.ts.map +1 -1
- package/dist/react/charts/radar/index.js.map +1 -1
- package/dist/react/charts/scatter/index.d.ts.map +1 -1
- package/dist/react/charts/scatter/index.js.map +1 -1
- package/docs/api/appkit-ui/data/AreaChart.md +82 -0
- package/docs/api/appkit-ui/data/BarChart.md +77 -0
- package/docs/api/appkit-ui/data/DonutChart.md +75 -0
- package/docs/api/appkit-ui/data/HeatmapChart.md +94 -0
- package/docs/api/appkit-ui/data/LineChart.md +80 -0
- package/docs/api/appkit-ui/data/PieChart.md +75 -0
- package/docs/api/appkit-ui/data/RadarChart.md +77 -0
- package/docs/api/appkit-ui/data/ScatterChart.md +79 -0
- package/docs/api/appkit-ui/genie/GenieChatMessageList.md +7 -7
- package/docs/api/appkit-ui/ui/Accordion.md +3 -3
- package/docs/api/appkit-ui/ui/ButtonGroup.md +5 -5
- package/docs/api/appkit-ui/ui/Calendar.md +7 -7
- package/docs/api/appkit-ui/ui/Carousel.md +1 -1
- package/docs/api/appkit-ui/ui/ContextMenu.md +13 -13
- package/docs/api/appkit-ui/ui/Drawer.md +1 -1
- package/docs/api/appkit-ui/ui/DropdownMenu.md +15 -15
- package/docs/api/appkit-ui/ui/Field.md +3 -3
- package/docs/api/appkit-ui/ui/HoverCard.md +4 -4
- package/docs/api/appkit-ui/ui/InputOTP.md +2 -2
- package/docs/api/appkit-ui/ui/Item.md +5 -5
- package/docs/api/appkit-ui/ui/Menubar.md +15 -15
- package/docs/api/appkit-ui/ui/NavigationMenu.md +11 -11
- package/docs/api/appkit-ui/ui/Popover.md +4 -4
- package/docs/api/appkit-ui/ui/RadioGroup.md +12 -12
- package/docs/api/appkit-ui/ui/ResizableHandle.md +23 -23
- package/docs/api/appkit-ui/ui/ScrollArea.md +11 -11
- package/docs/api/appkit-ui/ui/Select.md +10 -10
- package/docs/api/appkit-ui/ui/Separator.md +5 -5
- package/docs/api/appkit-ui/ui/Sheet.md +1 -1
- package/docs/api/appkit-ui/ui/Sidebar.md +15 -15
- package/docs/api/appkit-ui/ui/Slider.md +2 -2
- package/docs/api/appkit-ui/ui/Tabs.md +9 -9
- package/docs/api/appkit-ui/ui/Toaster.md +22 -22
- package/docs/api/appkit-ui/ui/ToggleGroup.md +3 -3
- package/docs/api/appkit-ui/ui/Tooltip.md +4 -4
- package/docs/development/llm-guide.md +1 -0
- package/docs/development/local-development.md +2 -0
- package/docs/plugins/agents.md +22 -22
- package/docs/plugins/caching.md +1 -1
- package/docs/plugins/execution-context.md +1 -1
- package/llms.txt +8 -0
- package/package.json +1 -1
- package/sbom.cdx.json +1 -1
package/CLAUDE.md
CHANGED
|
@@ -326,7 +326,15 @@ npx @databricks/appkit docs <query>
|
|
|
326
326
|
## appkit-ui API reference [collapsed]
|
|
327
327
|
|
|
328
328
|
- [@databricks/appkit-ui](./docs/api/appkit-ui.md): The library provides a set of UI primitives for building Databricks apps in React.
|
|
329
|
+
- [AreaChart](./docs/api/appkit-ui/data/AreaChart.md): Area Chart component for trend visualization with filled areas.
|
|
330
|
+
- [BarChart](./docs/api/appkit-ui/data/BarChart.md): Bar Chart component for categorical comparisons.
|
|
329
331
|
- [DataTable](./docs/api/appkit-ui/data/DataTable.md): Production-ready data table with automatic data fetching and state management
|
|
332
|
+
- [DonutChart](./docs/api/appkit-ui/data/DonutChart.md): Donut Chart component (Pie chart with inner radius).
|
|
333
|
+
- [HeatmapChart](./docs/api/appkit-ui/data/HeatmapChart.md): Heatmap Chart component for matrix-style data visualization.
|
|
334
|
+
- [LineChart](./docs/api/appkit-ui/data/LineChart.md): Line Chart component for time-series and trend visualization.
|
|
335
|
+
- [PieChart](./docs/api/appkit-ui/data/PieChart.md): Pie Chart component for proportional data visualization.
|
|
336
|
+
- [RadarChart](./docs/api/appkit-ui/data/RadarChart.md): Radar Chart component for multi-dimensional data comparison.
|
|
337
|
+
- [ScatterChart](./docs/api/appkit-ui/data/ScatterChart.md): Scatter Chart component for correlation and distribution visualization.
|
|
330
338
|
- [DirectoryList](./docs/api/appkit-ui/files/DirectoryList.md): Card-wrapped directory listing with loading, error, and empty states
|
|
331
339
|
- [FileBreadcrumb](./docs/api/appkit-ui/files/FileBreadcrumb.md): Path-aware breadcrumb navigation built on top of Breadcrumb primitives
|
|
332
340
|
- [FileEntry](./docs/api/appkit-ui/files/FileEntry.md): Single file or directory row with icon, name, size, and selection state
|
|
@@ -26,6 +26,22 @@ function parseHeaders(values) {
|
|
|
26
26
|
return headers;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
+
* Databricks Apps sit behind an OAuth proxy that 401s without a bearer, so send
|
|
30
|
+
* the resolved workspace token to a deployed app. Scoped to https
|
|
31
|
+
* `*.databricksapps.com` so the token never leaks to an arbitrary URL; an
|
|
32
|
+
* explicit `Authorization` header (`--header`) always wins.
|
|
33
|
+
*/
|
|
34
|
+
function withAppAuth(baseUrl, headers, token) {
|
|
35
|
+
if (!token || !URL.canParse(baseUrl)) return headers;
|
|
36
|
+
const { protocol, hostname } = new URL(baseUrl);
|
|
37
|
+
if (protocol !== "https:" || !hostname.endsWith(".databricksapps.com")) return headers;
|
|
38
|
+
if (Object.keys(headers ?? {}).some((k) => k.toLowerCase() === "authorization")) return headers;
|
|
39
|
+
return {
|
|
40
|
+
...headers,
|
|
41
|
+
Authorization: `Bearer ${token}`
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
29
45
|
* Parse `--min-pass-rate`: a finite number in `[0, 1]`, or `undefined` when
|
|
30
46
|
* unset. Throws on blank, out-of-range, or non-numeric input so a bad gate
|
|
31
47
|
* value fails fast instead of silently disabling or inverting the CI gate.
|
|
@@ -205,7 +221,7 @@ async function runAgentEval(filter, opts) {
|
|
|
205
221
|
filter,
|
|
206
222
|
tags: opts.tag,
|
|
207
223
|
strict: opts.strict,
|
|
208
|
-
headers: opts.header ? parseHeaders(opts.header) : void 0,
|
|
224
|
+
headers: withAppAuth(baseUrl, opts.header ? parseHeaders(opts.header) : void 0, auth.token),
|
|
209
225
|
concurrency,
|
|
210
226
|
mlflow: resolveMlflow(opts, auth),
|
|
211
227
|
judge: resolveJudge(opts, auth),
|
|
@@ -245,7 +261,7 @@ async function runAgentEval(filter, opts) {
|
|
|
245
261
|
if (!ok) process.exitCode = 1;
|
|
246
262
|
} else if (!stats.allPassed) process.exitCode = 1;
|
|
247
263
|
}
|
|
248
|
-
const agentEvalCommand = new Command("eval").description("Run agent evals (server/agents/<id>/evals/*.eval.ts) against a running app").argument("[filter]", "Only run evals whose <agent>/<id> contains this substring (or an exact agent id)").option("--url <url>", "Base URL of the app to drive (default: evals.config.ts baseUrl, else http://localhost:8000)").option("--strict", "Fail on soft-assertion misses too", false).option("--concurrency <n>", "Max evals to run concurrently (default 4; keep at or below the app's max concurrent streams per user)").option("--root <dir>", "Project root containing server/agents/ (default: cwd)").option("--header <header...>", "Extra request header as 'Key: value' (repeatable)").option("--tag <tag...>", "Only run evals tagged with one of these tags (repeatable)").option("--profile <name>", "Databricks CLI profile to authenticate with via OAuth (default: DATABRICKS_CONFIG_PROFILE)").option("--databricks-host <host>", "Databricks host for writing MLflow assessments (default: DATABRICKS_HOST)").option("--databricks-token <token>", "Databricks token for writing MLflow assessments (default: DATABRICKS_TOKEN)").option("--experiment <id>", "MLflow experiment id for the evaluation run (default: MLFLOW_EXPERIMENT_ID)").option("--warehouse-id <id>", "SQL warehouse id for reading managed eval datasets and writing assessments to UC-backed experiments (default: DATABRICKS_WAREHOUSE_ID, or MLFLOW_TRACING_SQL_WAREHOUSE_ID for assessments)").option("--judge-model <endpoint>", "Databricks serving endpoint to use as the LLM judge for t.judge.* (default: APPKIT_JUDGE_MODEL)").option("--timeout <ms>", "Default per-eval timeout in ms (a per-eval timeoutMs overrides it)").option("--retries <n>", "Re-run an eval up to N times when it fails on an infra error (turn/timeout); assertion failures are not retried").option("--min-pass-rate <rate>", "Gate on aggregate pass rate (0..1) instead of requiring every eval to pass; exit 1 when below").addOption(new Option("--reporter <format>", "Report format: text (live console), json (dashboards), or junit (CI test reporters)").choices([
|
|
264
|
+
const agentEvalCommand = new Command("eval").description("Run agent evals (server/agents/<id>/evals/*.eval.ts) against a running app").argument("[filter]", "Only run evals whose <agent>/<id> contains this substring (or an exact agent id)").option("--url <url>", "Base URL of the app to drive (default: evals.config.ts baseUrl, else http://localhost:8000)").option("--strict", "Fail on soft-assertion misses too", false).option("--concurrency <n>", "Max evals to run concurrently (default 4; keep at or below the app's max concurrent streams per user)").option("--root <dir>", "Project root containing server/agents/ (default: cwd)").option("--header <header...>", "Extra request header as 'Key: value' (repeatable)").option("--tag <tag...>", "Only run evals tagged with one of these tags (repeatable)").option("--profile <name>", "Databricks CLI profile to authenticate with via OAuth; the token is also sent to a deployed *.databricksapps.com --url (default: DATABRICKS_CONFIG_PROFILE)").option("--databricks-host <host>", "Databricks host for writing MLflow assessments (default: DATABRICKS_HOST)").option("--databricks-token <token>", "Databricks token for writing MLflow assessments (default: DATABRICKS_TOKEN)").option("--experiment <id>", "MLflow experiment id for the evaluation run (default: MLFLOW_EXPERIMENT_ID)").option("--warehouse-id <id>", "SQL warehouse id for reading managed eval datasets and writing assessments to UC-backed experiments (default: DATABRICKS_WAREHOUSE_ID, or MLFLOW_TRACING_SQL_WAREHOUSE_ID for assessments)").option("--judge-model <endpoint>", "Databricks serving endpoint to use as the LLM judge for t.judge.* (default: APPKIT_JUDGE_MODEL)").option("--timeout <ms>", "Default per-eval timeout in ms (a per-eval timeoutMs overrides it)").option("--retries <n>", "Re-run an eval up to N times when it fails on an infra error (turn/timeout); assertion failures are not retried").option("--min-pass-rate <rate>", "Gate on aggregate pass rate (0..1) instead of requiring every eval to pass; exit 1 when below").addOption(new Option("--reporter <format>", "Report format: text (live console), json (dashboards), or junit (CI test reporters)").choices([
|
|
249
265
|
"text",
|
|
250
266
|
"json",
|
|
251
267
|
"junit"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eval.js","names":[],"sources":["../../../../src/cli/commands/agent/eval.ts"],"sourcesContent":["import { type ChildProcess, spawn } from \"node:child_process\";\nimport fs from \"node:fs\";\n\nimport { Command, Option } from \"commander\";\n\ninterface EvalRunSummary {\n results: unknown[];\n mlflow?: {\n runId: string;\n report: {\n written: number;\n skipped: number;\n failures: Array<{ traceId: string; status?: number; error?: string }>;\n };\n finish: { finished: boolean; metricsError?: string; finishError?: string };\n };\n}\n\ntype EvalProgress =\n | { type: \"discovered\"; total: number }\n | { type: \"run-created\"; runId: string }\n | { type: \"start\"; id: string; index: number; total: number }\n | { type: \"result\"; result: unknown; index: number; total: number };\n\n/** Subset of `@databricks/appkit/beta`'s eval runner used by this command. */\ninterface EvalRunner {\n runEvalsInDir(opts: {\n rootDir?: string;\n baseUrl: string;\n filter?: string;\n tags?: string[];\n strict?: boolean;\n headers?: Record<string, string>;\n concurrency?: number;\n mlflow?: {\n host: string;\n token: string;\n experimentId: string;\n sqlWarehouseId?: string;\n };\n judge?: { host: string; token: string; model: string };\n workspaceClient?: unknown;\n warehouseId?: string;\n timeoutMs?: number;\n retries?: number;\n onEvent?: (event: EvalProgress) => void;\n }): Promise<EvalRunSummary>;\n resolveDatabricksAuth(opts: {\n profile?: string;\n host?: string;\n token?: string;\n }): Promise<{ host: string; token: string } | undefined>;\n resolveWorkspaceClient(opts: {\n profile?: string;\n host?: string;\n token?: string;\n }): unknown;\n formatEvalHeadline(result: unknown): string;\n loadRootEvalConfig(rootDir: string): Promise<EvalConfig | undefined>;\n evalGlyph(result: unknown): string;\n formatEvalDetail(result: unknown): string[];\n formatSummaryLine(results: unknown[]): string;\n formatResultsJson(results: unknown[]): string;\n formatResultsJUnit(results: unknown[]): string;\n summarize(results: unknown[]): { allPassed: boolean; passRate: number };\n}\n\n/** Subset of `@databricks/appkit/beta`'s `EvalConfig` the CLI reads. */\ninterface EvalConfig {\n maxConcurrency?: number;\n timeoutMs?: number;\n baseUrl?: string;\n webServer?: {\n command: string;\n url?: string;\n timeoutMs?: number;\n reuseExisting?: boolean;\n };\n}\n\n/**\n * Loaded at runtime from the consuming project so this command (which ships in\n * `@databricks/shared`) doesn't take a build-time dependency on appkit. The\n * specifier is a variable so the type checker treats it as `any`.\n */\nasync function loadRunner(): Promise<EvalRunner> {\n const spec = \"@databricks/appkit/beta\";\n try {\n return (await import(spec)) as unknown as EvalRunner;\n } catch (err) {\n throw new Error(\n \"Could not load @databricks/appkit. Run `appkit agent eval` from a \" +\n \"project with @databricks/appkit installed. \" +\n `Cause: ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n}\n\nfunction parseHeaders(values: string[]): Record<string, string> {\n const headers: Record<string, string> = {};\n for (const v of values) {\n const i = v.indexOf(\":\");\n if (i === -1) continue;\n headers[v.slice(0, i).trim()] = v.slice(i + 1).trim();\n }\n return headers;\n}\n\n/**\n * Parse `--min-pass-rate`: a finite number in `[0, 1]`, or `undefined` when\n * unset. Throws on blank, out-of-range, or non-numeric input so a bad gate\n * value fails fast instead of silently disabling or inverting the CI gate.\n */\nexport function parsePassRate(raw: string | undefined): number | undefined {\n if (raw === undefined) return undefined;\n const n = Number(raw);\n // Reject blank too: `Number(\"\")` is 0, which would silently disable the gate.\n if (raw.trim() === \"\" || !Number.isFinite(n) || n < 0 || n > 1) {\n throw new Error(\n `Invalid --min-pass-rate \"${raw}\" — expected a number in [0, 1]`,\n );\n }\n return n;\n}\n\n/** Parse a positive-integer CLI option; junk, zero, or negative → undefined. */\nfunction positiveInt(raw: string | undefined): number | undefined {\n const n = raw ? Number.parseInt(raw, 10) : Number.NaN;\n return n > 0 ? n : undefined;\n}\n\n/** True when `url` answers with any HTTP response (a 404 still proves it's up). */\nasync function isServerUp(url: string): Promise<boolean> {\n try {\n await fetch(url, { signal: AbortSignal.timeout(2000) });\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Start the app under test per a root config's `webServer`, à la Playwright:\n * reuse a server already answering at `url` (unless `reuseExisting: false`),\n * else spawn `command`, poll `url` until it answers or `timeoutMs` elapses.\n * Returns a `stop()` that kills the spawned process group (a no-op when the\n * server was reused). Under a machine reporter (`machine`) our logs and the\n * child's stdout are both routed to stderr, so the report stream on stdout\n * stays clean. Throws if the server never comes up.\n */\nasync function startWebServer(\n webServer: NonNullable<EvalConfig[\"webServer\"]>,\n baseUrl: string,\n machine: boolean,\n): Promise<{ stop: () => void }> {\n const url = webServer.url ?? baseUrl;\n const reuse = webServer.reuseExisting !== false;\n const noop = { stop: () => {} };\n\n if (reuse && (await isServerUp(url))) {\n console.error(`Reusing server already running at ${url}`);\n return noop;\n }\n\n console.error(`Starting web server: ${webServer.command}`);\n // `detached` + a negative-PID kill lets us tear down the whole process group\n // (dev servers spawn child processes). Under a machine reporter the child's\n // stdout is sent to our stderr (fd 2) so it can't corrupt the report we later\n // write to stdout; in text mode it inherits so the user sees build output.\n const child: ChildProcess = spawn(webServer.command, {\n shell: true,\n detached: true,\n stdio: machine ? [\"ignore\", 2, \"inherit\"] : \"inherit\",\n });\n\n let exited = false;\n child.on(\"exit\", () => {\n exited = true;\n });\n\n const stop = (): void => {\n if (exited || child.pid === undefined) return;\n try {\n process.kill(-child.pid, \"SIGTERM\");\n } catch {\n // Group already gone, or never became a leader — best-effort.\n }\n };\n\n const deadline = Date.now() + (webServer.timeoutMs ?? 60_000);\n try {\n while (Date.now() < deadline) {\n if (exited) throw new Error(\"web server exited before becoming ready\");\n if (await isServerUp(url)) {\n console.error(`Web server ready at ${url}`);\n return { stop };\n }\n await new Promise((r) => setTimeout(r, 500));\n }\n } catch (err) {\n stop();\n throw err;\n }\n stop();\n throw new Error(\n `web server did not respond at ${url} within ${webServer.timeoutMs ?? 60_000}ms`,\n );\n}\n\ninterface EvalOptions {\n url?: string;\n strict?: boolean;\n root?: string;\n header?: string[];\n tag?: string[];\n profile?: string;\n databricksHost?: string;\n databricksToken?: string;\n experiment?: string;\n judgeModel?: string;\n concurrency?: string;\n warehouseId?: string;\n timeout?: string;\n retries?: string;\n minPassRate?: string;\n reporter?: \"text\" | \"json\" | \"junit\";\n output?: string;\n}\n\n/** Resolved Databricks host + bearer (either field may be absent). */\ntype Auth = { host?: string; token?: string };\n\n/**\n * Native MLflow \"Evaluation run\" config — only when creds + an experiment are\n * all present (traces live in the app; the run + scores are driven from here).\n */\nfunction resolveMlflow(opts: EvalOptions, auth: Auth) {\n const experimentId = opts.experiment ?? process.env.MLFLOW_EXPERIMENT_ID;\n if (!(auth.host && auth.token && experimentId)) return undefined;\n // UC-backed experiments need a SQL warehouse to write assessments to their\n // V4 traces. Mirror mlflow's env var, and accept the common DATABRICKS one.\n const sqlWarehouseId =\n opts.warehouseId ??\n process.env.MLFLOW_TRACING_SQL_WAREHOUSE_ID ??\n process.env.DATABRICKS_WAREHOUSE_ID;\n return {\n host: auth.host,\n token: auth.token,\n experimentId,\n ...(sqlWarehouseId ? { sqlWarehouseId } : {}),\n };\n}\n\n/** LLM-as-judge config — reuses the Databricks creds + a judge serving endpoint. */\nfunction resolveJudge(opts: EvalOptions, auth: Auth) {\n const model = opts.judgeModel ?? process.env.APPKIT_JUDGE_MODEL;\n return model && auth.host && auth.token\n ? { host: auth.host, token: auth.token, model }\n : undefined;\n}\n\n/**\n * Progress reporter: stream each eval as it runs instead of going silent. In a\n * machine reporter (json/junit) the live per-eval streaming is suppressed and\n * banners go to stderr (via `info`), keeping stdout clean for the report.\n */\nfunction makeProgressReporter(\n runner: EvalRunner,\n url: string,\n machine: boolean,\n info: (msg: string) => void,\n): (event: EvalProgress) => void {\n return (event) => {\n switch (event.type) {\n case \"discovered\":\n info(\n `Running ${event.total} eval${event.total === 1 ? \"\" : \"s\"} against ${url}\\n`,\n );\n break;\n case \"run-created\":\n info(`MLflow evaluation run: ${event.runId}\\n`);\n break;\n case \"result\": {\n if (machine) break;\n // One full line per completion — evals run concurrently, so a split\n // \"start … glyph\" prefix would interleave into garbage.\n console.log(\n `[${event.index + 1}/${event.total}] ${runner.formatEvalHeadline(event.result)}`,\n );\n for (const line of runner.formatEvalDetail(event.result)) {\n console.log(line);\n }\n break;\n }\n }\n };\n}\n\nfunction formatFailureLine(f: {\n traceId: string;\n status?: number;\n error?: string;\n}): string {\n return ` ✗ trace ${f.traceId}: ${f.status ?? \"\"} ${f.error ?? \"\"}`.trim();\n}\n\n/**\n * Print the MLflow assessment/finish outcome after a run that created one. The\n * summary line goes through `info` (stderr under a machine reporter); per-trace\n * failures and finish errors always go to stderr.\n */\nfunction printMlflowOutcome(\n mlflow: NonNullable<EvalRunSummary[\"mlflow\"]>,\n info: (msg: string) => void,\n): void {\n const { report, finish } = mlflow;\n info(\n `MLflow: ${report.written} assessment(s) written` +\n (report.skipped ? `, ${report.skipped} skipped` : \"\") +\n (report.failures.length ? `, ${report.failures.length} failed` : \"\"),\n );\n for (const f of report.failures) {\n console.error(formatFailureLine(f));\n }\n if (finish.metricsError) {\n console.error(` ⚠ metrics not logged: ${finish.metricsError}`);\n }\n if (!finish.finished) {\n console.error(\n ` ✗ run left RUNNING — failed to finish: ${finish.finishError ?? \"unknown\"}`,\n );\n }\n}\n\nasync function runAgentEval(\n filter: string | undefined,\n opts: EvalOptions,\n): Promise<void> {\n const runner = await loadRunner();\n\n // Root `evals.config.ts` (project root) carries run-wide settings — baseUrl,\n // webServer, and defaults for concurrency/timeout. A CLI flag always wins.\n const rootDir = opts.root ?? process.cwd();\n const config = (await runner.loadRootEvalConfig(rootDir)) ?? {};\n\n // Base URL: --url flag > config.baseUrl > built-in default. `--url` has no\n // commander default so an unset flag is undefined and lets config win.\n const baseUrl = opts.url ?? config.baseUrl ?? \"http://localhost:8000\";\n\n // Databricks credentials shared by auth resolution and the workspace client:\n // an explicit flag/DATABRICKS_* env wins, else the SDK resolves from the CLI\n // profile.\n const credentials = {\n profile: opts.profile ?? process.env.DATABRICKS_CONFIG_PROFILE,\n host: opts.databricksHost ?? process.env.DATABRICKS_HOST,\n token: opts.databricksToken ?? process.env.DATABRICKS_TOKEN,\n };\n\n // Resolve Databricks host + bearer the AppKit-native way: an explicit\n // host/token wins; otherwise the SDK mints an OAuth token from the CLI\n // profile — so no hand-set PAT is required.\n const auth: Auth = (await runner.resolveDatabricksAuth(credentials)) ?? {};\n\n // Managed-dataset reads: a workspace client (same profile/host/token) + a SQL\n // warehouse. Only needed by evals that declare `dataset`.\n const warehouseId = opts.warehouseId ?? process.env.DATABRICKS_WAREHOUSE_ID;\n const workspaceClient = runner.resolveWorkspaceClient(credentials);\n\n // Max concurrency: the `--concurrency` flag wins over the root config's value\n // (junk/zero/negative → undefined, so it falls back); else the runner default.\n const concurrency = positiveInt(opts.concurrency) ?? config.maxConcurrency;\n\n // Runner-level default per-eval timeout (ms). --timeout flag wins over the\n // root config; a per-eval `timeoutMs` overrides both (applied in the runner).\n const timeoutMs = positiveInt(opts.timeout) ?? config.timeoutMs;\n\n // Extra attempts for evals that fail on an infra error (turn/timeout). Junk\n // or negative input falls back to no retries.\n const retries = positiveInt(opts.retries);\n\n // Validate up front so a bad gate value fails before the run, not after.\n let minPassRate: number | undefined;\n try {\n minPassRate = parsePassRate(opts.minPassRate);\n } catch (err) {\n console.error(err instanceof Error ? err.message : String(err));\n process.exitCode = 1;\n return;\n }\n\n // In a machine reporter (json/junit), stdout is reserved for the report (it\n // may be piped), so human-facing lines go to stderr and the per-eval live\n // streaming is suppressed. Text mode keeps its current stdout behavior.\n const reporter = opts.reporter ?? \"text\";\n const machine = reporter !== \"text\";\n const info = (msg: string): void => {\n if (machine) console.error(msg);\n else console.log(msg);\n };\n\n // Boot the app under test if the root config declares a webServer (reuses an\n // already-running server unless told otherwise); always torn down after. The\n // boot runs inside the try so a server that never comes up takes the clean\n // error path below instead of escaping as an unhandled rejection.\n let server: { stop: () => void } | undefined;\n let summary: EvalRunSummary;\n try {\n server = config.webServer\n ? await startWebServer(config.webServer, baseUrl, machine)\n : undefined;\n summary = await runner.runEvalsInDir({\n rootDir,\n baseUrl,\n filter,\n tags: opts.tag,\n strict: opts.strict,\n headers: opts.header ? parseHeaders(opts.header) : undefined,\n concurrency,\n mlflow: resolveMlflow(opts, auth),\n judge: resolveJudge(opts, auth),\n workspaceClient,\n warehouseId,\n timeoutMs,\n retries,\n onEvent: makeProgressReporter(runner, baseUrl, machine, info),\n });\n } catch (err) {\n // Setup failures — a web server that never comes up, or e.g. a bad\n // --experiment for the MLflow run — reject before any eval runs; surface a\n // clean message + non-zero exit rather than an unhandled promise rejection\n // with a raw stack.\n console.error(\n `\\nEval run failed: ${err instanceof Error ? err.message : String(err)}`,\n );\n process.exitCode = 1;\n return;\n } finally {\n server?.stop();\n }\n\n // The final human summary always shows (stderr for machine reporters so it\n // never pollutes the report on stdout/file).\n info(`\\n${runner.formatSummaryLine(summary.results)}`);\n\n if (summary.mlflow) {\n printMlflowOutcome(summary.mlflow, info);\n } else {\n info(\n \"\\nMLflow evaluation run skipped — pass --experiment (or set\" +\n \" MLFLOW_EXPERIMENT_ID) plus --profile/--databricks-host to create one.\",\n );\n }\n\n // Machine-readable report: build the string with a pure formatter, then emit\n // it to --output <file> or stdout (kept clean of the human noise above).\n if (machine) {\n const report =\n reporter === \"json\"\n ? runner.formatResultsJson(summary.results)\n : runner.formatResultsJUnit(summary.results);\n if (opts.output) {\n try {\n fs.writeFileSync(opts.output, `${report}\\n`);\n } catch (err) {\n console.error(\n `Failed to write ${reporter} report to ${opts.output}: ${\n err instanceof Error ? err.message : String(err)\n }`,\n );\n process.exitCode = 1;\n return;\n }\n info(`Wrote ${reporter} report to ${opts.output}`);\n } else {\n process.stdout.write(`${report}\\n`);\n }\n }\n\n const stats = runner.summarize(summary.results);\n if (minPassRate !== undefined) {\n // Threshold mode: gate on the aggregate pass rate rather than requiring\n // every eval to pass.\n const ok = stats.passRate >= minPassRate;\n info(\n `Pass rate ${(stats.passRate * 100).toFixed(0)}% (threshold ${(\n minPassRate * 100\n ).toFixed(0)}%) — ${ok ? \"OK\" : \"below threshold\"}`,\n );\n if (!ok) process.exitCode = 1;\n } else if (!stats.allPassed) {\n process.exitCode = 1;\n }\n}\n\nexport const agentEvalCommand = new Command(\"eval\")\n .description(\n \"Run agent evals (server/agents/<id>/evals/*.eval.ts) against a running app\",\n )\n .argument(\n \"[filter]\",\n \"Only run evals whose <agent>/<id> contains this substring (or an exact agent id)\",\n )\n .option(\n \"--url <url>\",\n \"Base URL of the app to drive (default: evals.config.ts baseUrl, else http://localhost:8000)\",\n )\n .option(\"--strict\", \"Fail on soft-assertion misses too\", false)\n .option(\n \"--concurrency <n>\",\n \"Max evals to run concurrently (default 4; keep at or below the app's max concurrent streams per user)\",\n )\n .option(\n \"--root <dir>\",\n \"Project root containing server/agents/ (default: cwd)\",\n )\n .option(\n \"--header <header...>\",\n \"Extra request header as 'Key: value' (repeatable)\",\n )\n .option(\n \"--tag <tag...>\",\n \"Only run evals tagged with one of these tags (repeatable)\",\n )\n .option(\n \"--profile <name>\",\n \"Databricks CLI profile to authenticate with via OAuth (default: DATABRICKS_CONFIG_PROFILE)\",\n )\n .option(\n \"--databricks-host <host>\",\n \"Databricks host for writing MLflow assessments (default: DATABRICKS_HOST)\",\n )\n .option(\n \"--databricks-token <token>\",\n \"Databricks token for writing MLflow assessments (default: DATABRICKS_TOKEN)\",\n )\n .option(\n \"--experiment <id>\",\n \"MLflow experiment id for the evaluation run (default: MLFLOW_EXPERIMENT_ID)\",\n )\n .option(\n \"--warehouse-id <id>\",\n \"SQL warehouse id for reading managed eval datasets and writing assessments to UC-backed experiments (default: DATABRICKS_WAREHOUSE_ID, or MLFLOW_TRACING_SQL_WAREHOUSE_ID for assessments)\",\n )\n .option(\n \"--judge-model <endpoint>\",\n \"Databricks serving endpoint to use as the LLM judge for t.judge.* (default: APPKIT_JUDGE_MODEL)\",\n )\n .option(\n \"--timeout <ms>\",\n \"Default per-eval timeout in ms (a per-eval timeoutMs overrides it)\",\n )\n .option(\n \"--retries <n>\",\n \"Re-run an eval up to N times when it fails on an infra error (turn/timeout); assertion failures are not retried\",\n )\n .option(\n \"--min-pass-rate <rate>\",\n \"Gate on aggregate pass rate (0..1) instead of requiring every eval to pass; exit 1 when below\",\n )\n .addOption(\n new Option(\n \"--reporter <format>\",\n \"Report format: text (live console), json (dashboards), or junit (CI test reporters)\",\n )\n .choices([\"text\", \"json\", \"junit\"])\n .default(\"text\"),\n )\n .option(\n \"--output <file>\",\n \"Write the json/junit report to this file instead of stdout (ignored for text)\",\n )\n .action(runAgentEval);\n"],"mappings":";;;;;;;;;;AAqFA,eAAe,aAAkC;CAC/C,MAAM,OAAO;AACb,KAAI;AACF,SAAQ,MAAM,OAAO;UACd,KAAK;AACZ,QAAM,IAAI,MACR,yHAEY,eAAe,QAAQ,IAAI,UAAU,OAAO,IAAI,GAC7D;;;AAIL,SAAS,aAAa,QAA0C;CAC9D,MAAM,UAAkC,EAAE;AAC1C,MAAK,MAAM,KAAK,QAAQ;EACtB,MAAM,IAAI,EAAE,QAAQ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AI,GAEnD;AACD,YAAQ,WAAW;AACnB;;AAEF,QAAK,SAAS,SAAS,aAAa,KAAK,SAAS;QAElD,SAAQ,OAAO,MAAM,GAAG,OAAO,IAAI;;CAIvC,MAAM,QAAQ,OAAO,UAAU,QAAQ,QAAQ;AAC/C,KAAI,gBAAgB,QAAW;EAG7B,MAAM,KAAK,MAAM,YAAY;AAC7B,OACE,cAAc,MAAM,WAAW,KAAK,QAAQ,EAAE,CAAC,gBAC7C,cAAc,KACd,QAAQ,EAAE,CAAC,OAAO,KAAK,OAAO,oBACjC;AACD,MAAI,CAAC,GAAI,SAAQ,WAAW;YACnB,CAAC,MAAM,UAChB,SAAQ,WAAW;;AAIvB,MAAa,mBAAmB,IAAI,QAAQ,OAAO,CAChD,YACC,6EACD,CACA,SACC,YACA,mFACD,CACA,OACC,eACA,8FACD,CACA,OAAO,YAAY,qCAAqC,MAAM,CAC9D,OACC,qBACA,wGACD,CACA,OACC,gBACA,wDACD,CACA,OACC,wBACA,oDACD,CACA,OACC,kBACA,4DACD,CACA,OACC,oBACA,6FACD,CACA,OACC,4BACA,4EACD,CACA,OACC,8BACA,8EACD,CACA,OACC,qBACA,8EACD,CACA,OACC,uBACA,6LACD,CACA,OACC,4BACA,kGACD,CACA,OACC,kBACA,qEACD,CACA,OACC,iBACA,kHACD,CACA,OACC,0BACA,gGACD,CACA,UACC,IAAI,OACF,uBACA,sFACD,CACE,QAAQ;CAAC;CAAQ;CAAQ;CAAQ,CAAC,CAClC,QAAQ,OAAO,CACnB,CACA,OACC,mBACA,gFACD,CACA,OAAO,aAAa"}
|
|
1
|
+
{"version":3,"file":"eval.js","names":[],"sources":["../../../../src/cli/commands/agent/eval.ts"],"sourcesContent":["import { type ChildProcess, spawn } from \"node:child_process\";\nimport fs from \"node:fs\";\n\nimport { Command, Option } from \"commander\";\n\ninterface EvalRunSummary {\n results: unknown[];\n mlflow?: {\n runId: string;\n report: {\n written: number;\n skipped: number;\n failures: Array<{ traceId: string; status?: number; error?: string }>;\n };\n finish: { finished: boolean; metricsError?: string; finishError?: string };\n };\n}\n\ntype EvalProgress =\n | { type: \"discovered\"; total: number }\n | { type: \"run-created\"; runId: string }\n | { type: \"start\"; id: string; index: number; total: number }\n | { type: \"result\"; result: unknown; index: number; total: number };\n\n/** Subset of `@databricks/appkit/beta`'s eval runner used by this command. */\ninterface EvalRunner {\n runEvalsInDir(opts: {\n rootDir?: string;\n baseUrl: string;\n filter?: string;\n tags?: string[];\n strict?: boolean;\n headers?: Record<string, string>;\n concurrency?: number;\n mlflow?: {\n host: string;\n token: string;\n experimentId: string;\n sqlWarehouseId?: string;\n };\n judge?: { host: string; token: string; model: string };\n workspaceClient?: unknown;\n warehouseId?: string;\n timeoutMs?: number;\n retries?: number;\n onEvent?: (event: EvalProgress) => void;\n }): Promise<EvalRunSummary>;\n resolveDatabricksAuth(opts: {\n profile?: string;\n host?: string;\n token?: string;\n }): Promise<{ host: string; token: string } | undefined>;\n resolveWorkspaceClient(opts: {\n profile?: string;\n host?: string;\n token?: string;\n }): unknown;\n formatEvalHeadline(result: unknown): string;\n loadRootEvalConfig(rootDir: string): Promise<EvalConfig | undefined>;\n evalGlyph(result: unknown): string;\n formatEvalDetail(result: unknown): string[];\n formatSummaryLine(results: unknown[]): string;\n formatResultsJson(results: unknown[]): string;\n formatResultsJUnit(results: unknown[]): string;\n summarize(results: unknown[]): { allPassed: boolean; passRate: number };\n}\n\n/** Subset of `@databricks/appkit/beta`'s `EvalConfig` the CLI reads. */\ninterface EvalConfig {\n maxConcurrency?: number;\n timeoutMs?: number;\n baseUrl?: string;\n webServer?: {\n command: string;\n url?: string;\n timeoutMs?: number;\n reuseExisting?: boolean;\n };\n}\n\n/**\n * Loaded at runtime from the consuming project so this command (which ships in\n * `@databricks/shared`) doesn't take a build-time dependency on appkit. The\n * specifier is a variable so the type checker treats it as `any`.\n */\nasync function loadRunner(): Promise<EvalRunner> {\n const spec = \"@databricks/appkit/beta\";\n try {\n return (await import(spec)) as unknown as EvalRunner;\n } catch (err) {\n throw new Error(\n \"Could not load @databricks/appkit. Run `appkit agent eval` from a \" +\n \"project with @databricks/appkit installed. \" +\n `Cause: ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n}\n\nfunction parseHeaders(values: string[]): Record<string, string> {\n const headers: Record<string, string> = {};\n for (const v of values) {\n const i = v.indexOf(\":\");\n if (i === -1) continue;\n headers[v.slice(0, i).trim()] = v.slice(i + 1).trim();\n }\n return headers;\n}\n\n/**\n * Databricks Apps sit behind an OAuth proxy that 401s without a bearer, so send\n * the resolved workspace token to a deployed app. Scoped to https\n * `*.databricksapps.com` so the token never leaks to an arbitrary URL; an\n * explicit `Authorization` header (`--header`) always wins.\n */\nexport function withAppAuth(\n baseUrl: string,\n headers: Record<string, string> | undefined,\n token: string | undefined,\n): Record<string, string> | undefined {\n if (!token || !URL.canParse(baseUrl)) return headers;\n const { protocol, hostname } = new URL(baseUrl);\n if (protocol !== \"https:\" || !hostname.endsWith(\".databricksapps.com\")) {\n return headers;\n }\n if (\n Object.keys(headers ?? {}).some((k) => k.toLowerCase() === \"authorization\")\n ) {\n return headers;\n }\n // shortcut: token is minted once per run (~1h for U2M), refresh if long runs start 401ing.\n return { ...headers, Authorization: `Bearer ${token}` };\n}\n\n/**\n * Parse `--min-pass-rate`: a finite number in `[0, 1]`, or `undefined` when\n * unset. Throws on blank, out-of-range, or non-numeric input so a bad gate\n * value fails fast instead of silently disabling or inverting the CI gate.\n */\nexport function parsePassRate(raw: string | undefined): number | undefined {\n if (raw === undefined) return undefined;\n const n = Number(raw);\n // Reject blank too: `Number(\"\")` is 0, which would silently disable the gate.\n if (raw.trim() === \"\" || !Number.isFinite(n) || n < 0 || n > 1) {\n throw new Error(\n `Invalid --min-pass-rate \"${raw}\" — expected a number in [0, 1]`,\n );\n }\n return n;\n}\n\n/** Parse a positive-integer CLI option; junk, zero, or negative → undefined. */\nfunction positiveInt(raw: string | undefined): number | undefined {\n const n = raw ? Number.parseInt(raw, 10) : Number.NaN;\n return n > 0 ? n : undefined;\n}\n\n/** True when `url` answers with any HTTP response (a 404 still proves it's up). */\nasync function isServerUp(url: string): Promise<boolean> {\n try {\n await fetch(url, { signal: AbortSignal.timeout(2000) });\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Start the app under test per a root config's `webServer`, à la Playwright:\n * reuse a server already answering at `url` (unless `reuseExisting: false`),\n * else spawn `command`, poll `url` until it answers or `timeoutMs` elapses.\n * Returns a `stop()` that kills the spawned process group (a no-op when the\n * server was reused). Under a machine reporter (`machine`) our logs and the\n * child's stdout are both routed to stderr, so the report stream on stdout\n * stays clean. Throws if the server never comes up.\n */\nasync function startWebServer(\n webServer: NonNullable<EvalConfig[\"webServer\"]>,\n baseUrl: string,\n machine: boolean,\n): Promise<{ stop: () => void }> {\n const url = webServer.url ?? baseUrl;\n const reuse = webServer.reuseExisting !== false;\n const noop = { stop: () => {} };\n\n if (reuse && (await isServerUp(url))) {\n console.error(`Reusing server already running at ${url}`);\n return noop;\n }\n\n console.error(`Starting web server: ${webServer.command}`);\n // `detached` + a negative-PID kill lets us tear down the whole process group\n // (dev servers spawn child processes). Under a machine reporter the child's\n // stdout is sent to our stderr (fd 2) so it can't corrupt the report we later\n // write to stdout; in text mode it inherits so the user sees build output.\n const child: ChildProcess = spawn(webServer.command, {\n shell: true,\n detached: true,\n stdio: machine ? [\"ignore\", 2, \"inherit\"] : \"inherit\",\n });\n\n let exited = false;\n child.on(\"exit\", () => {\n exited = true;\n });\n\n const stop = (): void => {\n if (exited || child.pid === undefined) return;\n try {\n process.kill(-child.pid, \"SIGTERM\");\n } catch {\n // Group already gone, or never became a leader — best-effort.\n }\n };\n\n const deadline = Date.now() + (webServer.timeoutMs ?? 60_000);\n try {\n while (Date.now() < deadline) {\n if (exited) throw new Error(\"web server exited before becoming ready\");\n if (await isServerUp(url)) {\n console.error(`Web server ready at ${url}`);\n return { stop };\n }\n await new Promise((r) => setTimeout(r, 500));\n }\n } catch (err) {\n stop();\n throw err;\n }\n stop();\n throw new Error(\n `web server did not respond at ${url} within ${webServer.timeoutMs ?? 60_000}ms`,\n );\n}\n\ninterface EvalOptions {\n url?: string;\n strict?: boolean;\n root?: string;\n header?: string[];\n tag?: string[];\n profile?: string;\n databricksHost?: string;\n databricksToken?: string;\n experiment?: string;\n judgeModel?: string;\n concurrency?: string;\n warehouseId?: string;\n timeout?: string;\n retries?: string;\n minPassRate?: string;\n reporter?: \"text\" | \"json\" | \"junit\";\n output?: string;\n}\n\n/** Resolved Databricks host + bearer (either field may be absent). */\ntype Auth = { host?: string; token?: string };\n\n/**\n * Native MLflow \"Evaluation run\" config — only when creds + an experiment are\n * all present (traces live in the app; the run + scores are driven from here).\n */\nfunction resolveMlflow(opts: EvalOptions, auth: Auth) {\n const experimentId = opts.experiment ?? process.env.MLFLOW_EXPERIMENT_ID;\n if (!(auth.host && auth.token && experimentId)) return undefined;\n // UC-backed experiments need a SQL warehouse to write assessments to their\n // V4 traces. Mirror mlflow's env var, and accept the common DATABRICKS one.\n const sqlWarehouseId =\n opts.warehouseId ??\n process.env.MLFLOW_TRACING_SQL_WAREHOUSE_ID ??\n process.env.DATABRICKS_WAREHOUSE_ID;\n return {\n host: auth.host,\n token: auth.token,\n experimentId,\n ...(sqlWarehouseId ? { sqlWarehouseId } : {}),\n };\n}\n\n/** LLM-as-judge config — reuses the Databricks creds + a judge serving endpoint. */\nfunction resolveJudge(opts: EvalOptions, auth: Auth) {\n const model = opts.judgeModel ?? process.env.APPKIT_JUDGE_MODEL;\n return model && auth.host && auth.token\n ? { host: auth.host, token: auth.token, model }\n : undefined;\n}\n\n/**\n * Progress reporter: stream each eval as it runs instead of going silent. In a\n * machine reporter (json/junit) the live per-eval streaming is suppressed and\n * banners go to stderr (via `info`), keeping stdout clean for the report.\n */\nfunction makeProgressReporter(\n runner: EvalRunner,\n url: string,\n machine: boolean,\n info: (msg: string) => void,\n): (event: EvalProgress) => void {\n return (event) => {\n switch (event.type) {\n case \"discovered\":\n info(\n `Running ${event.total} eval${event.total === 1 ? \"\" : \"s\"} against ${url}\\n`,\n );\n break;\n case \"run-created\":\n info(`MLflow evaluation run: ${event.runId}\\n`);\n break;\n case \"result\": {\n if (machine) break;\n // One full line per completion — evals run concurrently, so a split\n // \"start … glyph\" prefix would interleave into garbage.\n console.log(\n `[${event.index + 1}/${event.total}] ${runner.formatEvalHeadline(event.result)}`,\n );\n for (const line of runner.formatEvalDetail(event.result)) {\n console.log(line);\n }\n break;\n }\n }\n };\n}\n\nfunction formatFailureLine(f: {\n traceId: string;\n status?: number;\n error?: string;\n}): string {\n return ` ✗ trace ${f.traceId}: ${f.status ?? \"\"} ${f.error ?? \"\"}`.trim();\n}\n\n/**\n * Print the MLflow assessment/finish outcome after a run that created one. The\n * summary line goes through `info` (stderr under a machine reporter); per-trace\n * failures and finish errors always go to stderr.\n */\nfunction printMlflowOutcome(\n mlflow: NonNullable<EvalRunSummary[\"mlflow\"]>,\n info: (msg: string) => void,\n): void {\n const { report, finish } = mlflow;\n info(\n `MLflow: ${report.written} assessment(s) written` +\n (report.skipped ? `, ${report.skipped} skipped` : \"\") +\n (report.failures.length ? `, ${report.failures.length} failed` : \"\"),\n );\n for (const f of report.failures) {\n console.error(formatFailureLine(f));\n }\n if (finish.metricsError) {\n console.error(` ⚠ metrics not logged: ${finish.metricsError}`);\n }\n if (!finish.finished) {\n console.error(\n ` ✗ run left RUNNING — failed to finish: ${finish.finishError ?? \"unknown\"}`,\n );\n }\n}\n\nasync function runAgentEval(\n filter: string | undefined,\n opts: EvalOptions,\n): Promise<void> {\n const runner = await loadRunner();\n\n // Root `evals.config.ts` (project root) carries run-wide settings — baseUrl,\n // webServer, and defaults for concurrency/timeout. A CLI flag always wins.\n const rootDir = opts.root ?? process.cwd();\n const config = (await runner.loadRootEvalConfig(rootDir)) ?? {};\n\n // Base URL: --url flag > config.baseUrl > built-in default. `--url` has no\n // commander default so an unset flag is undefined and lets config win.\n const baseUrl = opts.url ?? config.baseUrl ?? \"http://localhost:8000\";\n\n // Databricks credentials shared by auth resolution and the workspace client:\n // an explicit flag/DATABRICKS_* env wins, else the SDK resolves from the CLI\n // profile.\n const credentials = {\n profile: opts.profile ?? process.env.DATABRICKS_CONFIG_PROFILE,\n host: opts.databricksHost ?? process.env.DATABRICKS_HOST,\n token: opts.databricksToken ?? process.env.DATABRICKS_TOKEN,\n };\n\n // Resolve Databricks host + bearer the AppKit-native way: an explicit\n // host/token wins; otherwise the SDK mints an OAuth token from the CLI\n // profile — so no hand-set PAT is required.\n const auth: Auth = (await runner.resolveDatabricksAuth(credentials)) ?? {};\n\n // Managed-dataset reads: a workspace client (same profile/host/token) + a SQL\n // warehouse. Only needed by evals that declare `dataset`.\n const warehouseId = opts.warehouseId ?? process.env.DATABRICKS_WAREHOUSE_ID;\n const workspaceClient = runner.resolveWorkspaceClient(credentials);\n\n // Max concurrency: the `--concurrency` flag wins over the root config's value\n // (junk/zero/negative → undefined, so it falls back); else the runner default.\n const concurrency = positiveInt(opts.concurrency) ?? config.maxConcurrency;\n\n // Runner-level default per-eval timeout (ms). --timeout flag wins over the\n // root config; a per-eval `timeoutMs` overrides both (applied in the runner).\n const timeoutMs = positiveInt(opts.timeout) ?? config.timeoutMs;\n\n // Extra attempts for evals that fail on an infra error (turn/timeout). Junk\n // or negative input falls back to no retries.\n const retries = positiveInt(opts.retries);\n\n // Validate up front so a bad gate value fails before the run, not after.\n let minPassRate: number | undefined;\n try {\n minPassRate = parsePassRate(opts.minPassRate);\n } catch (err) {\n console.error(err instanceof Error ? err.message : String(err));\n process.exitCode = 1;\n return;\n }\n\n // In a machine reporter (json/junit), stdout is reserved for the report (it\n // may be piped), so human-facing lines go to stderr and the per-eval live\n // streaming is suppressed. Text mode keeps its current stdout behavior.\n const reporter = opts.reporter ?? \"text\";\n const machine = reporter !== \"text\";\n const info = (msg: string): void => {\n if (machine) console.error(msg);\n else console.log(msg);\n };\n\n // Boot the app under test if the root config declares a webServer (reuses an\n // already-running server unless told otherwise); always torn down after. The\n // boot runs inside the try so a server that never comes up takes the clean\n // error path below instead of escaping as an unhandled rejection.\n let server: { stop: () => void } | undefined;\n let summary: EvalRunSummary;\n try {\n server = config.webServer\n ? await startWebServer(config.webServer, baseUrl, machine)\n : undefined;\n summary = await runner.runEvalsInDir({\n rootDir,\n baseUrl,\n filter,\n tags: opts.tag,\n strict: opts.strict,\n headers: withAppAuth(\n baseUrl,\n opts.header ? parseHeaders(opts.header) : undefined,\n auth.token,\n ),\n concurrency,\n mlflow: resolveMlflow(opts, auth),\n judge: resolveJudge(opts, auth),\n workspaceClient,\n warehouseId,\n timeoutMs,\n retries,\n onEvent: makeProgressReporter(runner, baseUrl, machine, info),\n });\n } catch (err) {\n // Setup failures — a web server that never comes up, or e.g. a bad\n // --experiment for the MLflow run — reject before any eval runs; surface a\n // clean message + non-zero exit rather than an unhandled promise rejection\n // with a raw stack.\n console.error(\n `\\nEval run failed: ${err instanceof Error ? err.message : String(err)}`,\n );\n process.exitCode = 1;\n return;\n } finally {\n server?.stop();\n }\n\n // The final human summary always shows (stderr for machine reporters so it\n // never pollutes the report on stdout/file).\n info(`\\n${runner.formatSummaryLine(summary.results)}`);\n\n if (summary.mlflow) {\n printMlflowOutcome(summary.mlflow, info);\n } else {\n info(\n \"\\nMLflow evaluation run skipped — pass --experiment (or set\" +\n \" MLFLOW_EXPERIMENT_ID) plus --profile/--databricks-host to create one.\",\n );\n }\n\n // Machine-readable report: build the string with a pure formatter, then emit\n // it to --output <file> or stdout (kept clean of the human noise above).\n if (machine) {\n const report =\n reporter === \"json\"\n ? runner.formatResultsJson(summary.results)\n : runner.formatResultsJUnit(summary.results);\n if (opts.output) {\n try {\n fs.writeFileSync(opts.output, `${report}\\n`);\n } catch (err) {\n console.error(\n `Failed to write ${reporter} report to ${opts.output}: ${\n err instanceof Error ? err.message : String(err)\n }`,\n );\n process.exitCode = 1;\n return;\n }\n info(`Wrote ${reporter} report to ${opts.output}`);\n } else {\n process.stdout.write(`${report}\\n`);\n }\n }\n\n const stats = runner.summarize(summary.results);\n if (minPassRate !== undefined) {\n // Threshold mode: gate on the aggregate pass rate rather than requiring\n // every eval to pass.\n const ok = stats.passRate >= minPassRate;\n info(\n `Pass rate ${(stats.passRate * 100).toFixed(0)}% (threshold ${(\n minPassRate * 100\n ).toFixed(0)}%) — ${ok ? \"OK\" : \"below threshold\"}`,\n );\n if (!ok) process.exitCode = 1;\n } else if (!stats.allPassed) {\n process.exitCode = 1;\n }\n}\n\nexport const agentEvalCommand = new Command(\"eval\")\n .description(\n \"Run agent evals (server/agents/<id>/evals/*.eval.ts) against a running app\",\n )\n .argument(\n \"[filter]\",\n \"Only run evals whose <agent>/<id> contains this substring (or an exact agent id)\",\n )\n .option(\n \"--url <url>\",\n \"Base URL of the app to drive (default: evals.config.ts baseUrl, else http://localhost:8000)\",\n )\n .option(\"--strict\", \"Fail on soft-assertion misses too\", false)\n .option(\n \"--concurrency <n>\",\n \"Max evals to run concurrently (default 4; keep at or below the app's max concurrent streams per user)\",\n )\n .option(\n \"--root <dir>\",\n \"Project root containing server/agents/ (default: cwd)\",\n )\n .option(\n \"--header <header...>\",\n \"Extra request header as 'Key: value' (repeatable)\",\n )\n .option(\n \"--tag <tag...>\",\n \"Only run evals tagged with one of these tags (repeatable)\",\n )\n .option(\n \"--profile <name>\",\n \"Databricks CLI profile to authenticate with via OAuth; the token is also sent to a deployed *.databricksapps.com --url (default: DATABRICKS_CONFIG_PROFILE)\",\n )\n .option(\n \"--databricks-host <host>\",\n \"Databricks host for writing MLflow assessments (default: DATABRICKS_HOST)\",\n )\n .option(\n \"--databricks-token <token>\",\n \"Databricks token for writing MLflow assessments (default: DATABRICKS_TOKEN)\",\n )\n .option(\n \"--experiment <id>\",\n \"MLflow experiment id for the evaluation run (default: MLFLOW_EXPERIMENT_ID)\",\n )\n .option(\n \"--warehouse-id <id>\",\n \"SQL warehouse id for reading managed eval datasets and writing assessments to UC-backed experiments (default: DATABRICKS_WAREHOUSE_ID, or MLFLOW_TRACING_SQL_WAREHOUSE_ID for assessments)\",\n )\n .option(\n \"--judge-model <endpoint>\",\n \"Databricks serving endpoint to use as the LLM judge for t.judge.* (default: APPKIT_JUDGE_MODEL)\",\n )\n .option(\n \"--timeout <ms>\",\n \"Default per-eval timeout in ms (a per-eval timeoutMs overrides it)\",\n )\n .option(\n \"--retries <n>\",\n \"Re-run an eval up to N times when it fails on an infra error (turn/timeout); assertion failures are not retried\",\n )\n .option(\n \"--min-pass-rate <rate>\",\n \"Gate on aggregate pass rate (0..1) instead of requiring every eval to pass; exit 1 when below\",\n )\n .addOption(\n new Option(\n \"--reporter <format>\",\n \"Report format: text (live console), json (dashboards), or junit (CI test reporters)\",\n )\n .choices([\"text\", \"json\", \"junit\"])\n .default(\"text\"),\n )\n .option(\n \"--output <file>\",\n \"Write the json/junit report to this file instead of stdout (ignored for text)\",\n )\n .action(runAgentEval);\n"],"mappings":";;;;;;;;;;AAqFA,eAAe,aAAkC;CAC/C,MAAM,OAAO;AACb,KAAI;AACF,SAAQ,MAAM,OAAO;UACd,KAAK;AACZ,QAAM,IAAI,MACR,yHAEY,eAAe,QAAQ,IAAI,UAAU,OAAO,IAAI,GAC7D;;;AAIL,SAAS,aAAa,QAA0C;CAC9D,MAAM,UAAkC,EAAE;AAC1C,MAAK,MAAM,KAAK,QAAQ;EACtB,MAAM,IAAI,EAAE,QAAQ,IAAI;AACxB,MAAI,MAAM,GAAI;AACd,UAAQ,EAAE,MAAM,GAAG,EAAE,CAAC,MAAM,IAAI,EAAE,MAAM,IAAI,EAAE,CAAC,MAAM;;AAEvD,QAAO;;;;;;;;AAST,SAAgB,YACd,SACA,SACA,OACoC;AACpC,KAAI,CAAC,SAAS,CAAC,IAAI,SAAS,QAAQ,CAAE,QAAO;CAC7C,MAAM,EAAE,UAAU,aAAa,IAAI,IAAI,QAAQ;AAC/C,KAAI,aAAa,YAAY,CAAC,SAAS,SAAS,sBAAsB,CACpE,QAAO;AAET,KACE,OAAO,KAAK,WAAW,EAAE,CAAC,CAAC,MAA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ACD,YAAQ,WAAW;AACnB;;AAEF,QAAK,SAAS,SAAS,aAAa,KAAK,SAAS;QAElD,SAAQ,OAAO,MAAM,GAAG,OAAO,IAAI;;CAIvC,MAAM,QAAQ,OAAO,UAAU,QAAQ,QAAQ;AAC/C,KAAI,gBAAgB,QAAW;EAG7B,MAAM,KAAK,MAAM,YAAY;AAC7B,OACE,cAAc,MAAM,WAAW,KAAK,QAAQ,EAAE,CAAC,gBAC7C,cAAc,KACd,QAAQ,EAAE,CAAC,OAAO,KAAK,OAAO,oBACjC;AACD,MAAI,CAAC,GAAI,SAAQ,WAAW;YACnB,CAAC,MAAM,UAChB,SAAQ,WAAW;;AAIvB,MAAa,mBAAmB,IAAI,QAAQ,OAAO,CAChD,YACC,6EACD,CACA,SACC,YACA,mFACD,CACA,OACC,eACA,8FACD,CACA,OAAO,YAAY,qCAAqC,MAAM,CAC9D,OACC,qBACA,wGACD,CACA,OACC,gBACA,wDACD,CACA,OACC,wBACA,oDACD,CACA,OACC,kBACA,4DACD,CACA,OACC,oBACA,8JACD,CACA,OACC,4BACA,4EACD,CACA,OACC,8BACA,8EACD,CACA,OACC,qBACA,8EACD,CACA,OACC,uBACA,6LACD,CACA,OACC,4BACA,kGACD,CACA,OACC,kBACA,qEACD,CACA,OACC,iBACA,kHACD,CACA,OACC,0BACA,gGACD,CACA,UACC,IAAI,OACF,uBACA,sFACD,CACE,QAAQ;CAAC;CAAQ;CAAQ;CAAQ,CAAC,CAClC,QAAQ,OAAO,CACnB,CACA,OACC,mBACA,gFACD,CACA,OAAO,aAAa"}
|
|
@@ -69,11 +69,13 @@ function readYaml(filePath) {
|
|
|
69
69
|
function readBundleInfo(cwd = process.cwd(), bundleFile = DATABRICKS_YML_FILE, appYamlFile = APP_YAML_FILE) {
|
|
70
70
|
const bindings = /* @__PURE__ */ new Map();
|
|
71
71
|
const envToBinding = /* @__PURE__ */ new Map();
|
|
72
|
+
const wiredEnvVars = /* @__PURE__ */ new Set();
|
|
72
73
|
const declaredResources = /* @__PURE__ */ new Set();
|
|
73
74
|
const doc = readYaml(path.resolve(cwd, bundleFile));
|
|
74
75
|
if (!doc) return {
|
|
75
76
|
bindings,
|
|
76
77
|
envToBinding,
|
|
78
|
+
wiredEnvVars,
|
|
77
79
|
declaredResources,
|
|
78
80
|
present: false
|
|
79
81
|
};
|
|
@@ -92,10 +94,17 @@ function readBundleInfo(cwd = process.cwd(), bundleFile = DATABRICKS_YML_FILE, a
|
|
|
92
94
|
});
|
|
93
95
|
}
|
|
94
96
|
const appYaml = readYaml(path.resolve(cwd, appYamlFile));
|
|
95
|
-
for (const entry of appYaml?.env ?? [])
|
|
97
|
+
for (const entry of appYaml?.env ?? []) {
|
|
98
|
+
if (!entry?.name) continue;
|
|
99
|
+
if (entry.valueFrom) {
|
|
100
|
+
envToBinding.set(entry.name, entry.valueFrom);
|
|
101
|
+
wiredEnvVars.add(entry.name);
|
|
102
|
+
} else if (entry.value != null) wiredEnvVars.add(entry.name);
|
|
103
|
+
}
|
|
96
104
|
return {
|
|
97
105
|
bindings,
|
|
98
106
|
envToBinding,
|
|
107
|
+
wiredEnvVars,
|
|
99
108
|
declaredResources,
|
|
100
109
|
present: true
|
|
101
110
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.js","names":[],"sources":["../../../../src/cli/commands/doctor/bundle.ts"],"sourcesContent":["/**\n * Reads `databricks.yml` + `app.yaml` for two things doctor can't get from\n * `appkit.plugins.json`:\n *\n * 1. **Provenance** — whether each binding references an existing resource\n * (`${var.*}`/literal → `external`) or one this bundle creates\n * (`${resources.<type>.<key>.*}` → `bundle-managed`).\n * 2. **Wiring** — the binding `name` joins the three files: `app.yaml`'s\n * `valueFrom: <name>` must match a `databricks.yml` binding `name`.\n *\n * SDK-free; pure YAML parsing. Absent files degrade to empty results.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport yaml from \"js-yaml\";\n\nimport {\n APP_YAML_FILE,\n bindingTypeOf,\n DATABRICKS_YML_FILE,\n} from \"../../deploy-config\";\nimport type { ResourceOrigin } from \"./types\";\nimport { errorMessage } from \"./utils\";\n\n/** A `${resources.<type>.<key>.<field>}` reference — a bundle-created resource. */\nconst RESOURCES_REF = /\\$\\{resources\\.([^.]+)\\.([^.}]+)\\.[^}]+\\}/;\n\n/** One app resource binding from `resources.apps.<app>.resources[]`. */\nexport interface BundleBinding {\n /** The binding name — the join key with `app.yaml` `valueFrom`. */\n name: string;\n /** The typed sub-key that names the kind (`sql_warehouse`, `genie_space`, …). */\n type?: string;\n origin: ResourceOrigin;\n /** For bundle-managed bindings: the `<type>.<key>` it references, if parseable. */\n ref?: { type: string; key: string };\n}\n\nexport interface BundleInfo {\n /** Bindings under every app, keyed by binding name. */\n bindings: Map<string, BundleBinding>;\n /** `app.yaml` env var name → binding name (from `valueFrom`). */\n envToBinding: Map<string, string>;\n /** Declared bundle resource keys, as `\"<type>.<key>\"`, for ref-integrity. */\n declaredResources: Set<string>;\n /** True when a `databricks.yml` was found and parsed. */\n present: boolean;\n}\n\ninterface AppResourceBlock {\n name?: string;\n [k: string]: unknown;\n}\ninterface BundleAppBlock {\n resources?: AppResourceBlock[];\n}\ninterface BundleDoc {\n resources?: {\n apps?: Record<string, BundleAppBlock>;\n [otherType: string]: Record<string, unknown> | undefined;\n };\n}\ninterface AppYamlDoc {\n env?: Array<{ name?: string; valueFrom?: string }>;\n}\n\n/** Classifies a binding by its typed sub-key and origin: scanning its field\n * values for a `${resources.*}` reference (bundle-managed) vs anything else\n * (external). */\nfunction classifyBinding(block: AppResourceBlock): {\n type?: string;\n origin: ResourceOrigin;\n ref?: { type: string; key: string };\n} {\n const type = bindingTypeOf(block);\n const typed = type ? block[type] : undefined;\n if (typed && typeof typed === \"object\") {\n for (const value of Object.values(typed as Record<string, unknown>)) {\n if (typeof value !== \"string\") continue;\n const m = value.match(RESOURCES_REF);\n if (m) {\n return {\n type,\n origin: \"bundle-managed\",\n ref: { type: m[1], key: m[2] },\n };\n }\n }\n }\n return { type, origin: \"external\" };\n}\n\n/**\n * Reads and parses a YAML file. Returns `null` when the file is absent (a\n * legitimate \"no bundle\" state); throws on invalid YAML, since silently\n * ignoring it would let doctor report a false all-clear.\n */\nfunction readYaml<T>(filePath: string): T | null {\n let raw: string;\n try {\n raw = fs.readFileSync(filePath, \"utf-8\");\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === \"ENOENT\") return null;\n throw err;\n }\n try {\n return (yaml.load(raw) ?? {}) as T;\n } catch (err) {\n throw new Error(\n `Failed to parse ${path.basename(filePath)}: ${errorMessage(err)}`,\n );\n }\n}\n\n/**\n * Parses `databricks.yml` (+ `app.yaml`) into {@link BundleInfo}. Returns an\n * empty-but-`present:false` result when no bundle is found, so callers can treat\n * \"no bundle\" as \"everything external\" without special-casing.\n */\nexport function readBundleInfo(\n cwd: string = process.cwd(),\n bundleFile: string = DATABRICKS_YML_FILE,\n appYamlFile: string = APP_YAML_FILE,\n): BundleInfo {\n const bindings = new Map<string, BundleBinding>();\n const envToBinding = new Map<string, string>();\n const declaredResources = new Set<string>();\n\n const doc = readYaml<BundleDoc>(path.resolve(cwd, bundleFile));\n if (!doc) {\n return {
|
|
1
|
+
{"version":3,"file":"bundle.js","names":[],"sources":["../../../../src/cli/commands/doctor/bundle.ts"],"sourcesContent":["/**\n * Reads `databricks.yml` + `app.yaml` for two things doctor can't get from\n * `appkit.plugins.json`:\n *\n * 1. **Provenance** — whether each binding references an existing resource\n * (`${var.*}`/literal → `external`) or one this bundle creates\n * (`${resources.<type>.<key>.*}` → `bundle-managed`).\n * 2. **Wiring** — the binding `name` joins the three files: `app.yaml`'s\n * `valueFrom: <name>` must match a `databricks.yml` binding `name`.\n *\n * SDK-free; pure YAML parsing. Absent files degrade to empty results.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport yaml from \"js-yaml\";\n\nimport {\n APP_YAML_FILE,\n bindingTypeOf,\n DATABRICKS_YML_FILE,\n} from \"../../deploy-config\";\nimport type { ResourceOrigin } from \"./types\";\nimport { errorMessage } from \"./utils\";\n\n/** A `${resources.<type>.<key>.<field>}` reference — a bundle-created resource. */\nconst RESOURCES_REF = /\\$\\{resources\\.([^.]+)\\.([^.}]+)\\.[^}]+\\}/;\n\n/** One app resource binding from `resources.apps.<app>.resources[]`. */\nexport interface BundleBinding {\n /** The binding name — the join key with `app.yaml` `valueFrom`. */\n name: string;\n /** The typed sub-key that names the kind (`sql_warehouse`, `genie_space`, …). */\n type?: string;\n origin: ResourceOrigin;\n /** For bundle-managed bindings: the `<type>.<key>` it references, if parseable. */\n ref?: { type: string; key: string };\n}\n\nexport interface BundleInfo {\n /** Bindings under every app, keyed by binding name. */\n bindings: Map<string, BundleBinding>;\n /** `app.yaml` env var name → binding name (from `valueFrom`). */\n envToBinding: Map<string, string>;\n /** `app.yaml` env var names the platform sets on deploy: via `valueFrom` or a\n * literal `value`. */\n wiredEnvVars: Set<string>;\n /** Declared bundle resource keys, as `\"<type>.<key>\"`, for ref-integrity. */\n declaredResources: Set<string>;\n /** True when a `databricks.yml` was found and parsed. */\n present: boolean;\n}\n\ninterface AppResourceBlock {\n name?: string;\n [k: string]: unknown;\n}\ninterface BundleAppBlock {\n resources?: AppResourceBlock[];\n}\ninterface BundleDoc {\n resources?: {\n apps?: Record<string, BundleAppBlock>;\n [otherType: string]: Record<string, unknown> | undefined;\n };\n}\ninterface AppYamlDoc {\n env?: Array<{ name?: string; valueFrom?: string; value?: unknown }>;\n}\n\n/** Classifies a binding by its typed sub-key and origin: scanning its field\n * values for a `${resources.*}` reference (bundle-managed) vs anything else\n * (external). */\nfunction classifyBinding(block: AppResourceBlock): {\n type?: string;\n origin: ResourceOrigin;\n ref?: { type: string; key: string };\n} {\n const type = bindingTypeOf(block);\n const typed = type ? block[type] : undefined;\n if (typed && typeof typed === \"object\") {\n for (const value of Object.values(typed as Record<string, unknown>)) {\n if (typeof value !== \"string\") continue;\n const m = value.match(RESOURCES_REF);\n if (m) {\n return {\n type,\n origin: \"bundle-managed\",\n ref: { type: m[1], key: m[2] },\n };\n }\n }\n }\n return { type, origin: \"external\" };\n}\n\n/**\n * Reads and parses a YAML file. Returns `null` when the file is absent (a\n * legitimate \"no bundle\" state); throws on invalid YAML, since silently\n * ignoring it would let doctor report a false all-clear.\n */\nfunction readYaml<T>(filePath: string): T | null {\n let raw: string;\n try {\n raw = fs.readFileSync(filePath, \"utf-8\");\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === \"ENOENT\") return null;\n throw err;\n }\n try {\n return (yaml.load(raw) ?? {}) as T;\n } catch (err) {\n throw new Error(\n `Failed to parse ${path.basename(filePath)}: ${errorMessage(err)}`,\n );\n }\n}\n\n/**\n * Parses `databricks.yml` (+ `app.yaml`) into {@link BundleInfo}. Returns an\n * empty-but-`present:false` result when no bundle is found, so callers can treat\n * \"no bundle\" as \"everything external\" without special-casing.\n */\nexport function readBundleInfo(\n cwd: string = process.cwd(),\n bundleFile: string = DATABRICKS_YML_FILE,\n appYamlFile: string = APP_YAML_FILE,\n): BundleInfo {\n const bindings = new Map<string, BundleBinding>();\n const envToBinding = new Map<string, string>();\n const wiredEnvVars = new Set<string>();\n const declaredResources = new Set<string>();\n\n const doc = readYaml<BundleDoc>(path.resolve(cwd, bundleFile));\n if (!doc) {\n return {\n bindings,\n envToBinding,\n wiredEnvVars,\n declaredResources,\n present: false,\n };\n }\n\n for (const [type, group] of Object.entries(doc.resources ?? {})) {\n if (!group || typeof group !== \"object\") continue;\n for (const key of Object.keys(group))\n declaredResources.add(`${type}.${key}`);\n }\n\n for (const app of Object.values(doc.resources?.apps ?? {})) {\n for (const block of app.resources ?? []) {\n if (!block?.name) continue;\n const { type, origin, ref } = classifyBinding(block);\n bindings.set(block.name, {\n name: block.name,\n type,\n origin,\n ref,\n });\n }\n }\n\n const appYaml = readYaml<AppYamlDoc>(path.resolve(cwd, appYamlFile));\n for (const entry of appYaml?.env ?? []) {\n if (!entry?.name) continue;\n if (entry.valueFrom) {\n envToBinding.set(entry.name, entry.valueFrom);\n wiredEnvVars.add(entry.name);\n } else if (entry.value != null) {\n // A literal `value: \"\"` still sets the var; a bare `value:` (null) doesn't.\n wiredEnvVars.add(entry.name);\n }\n }\n\n return {\n bindings,\n envToBinding,\n wiredEnvVars,\n declaredResources,\n present: true,\n };\n}\n\n/**\n * Resolves the origin for a target given its env vars, by walking\n * env var → binding name → binding origin. Returns undefined when the bundle\n * has nothing to say (so the target stays external by default).\n */\nexport function originForEnvVars(\n envVars: string[],\n info: BundleInfo,\n): ResourceOrigin | undefined {\n if (!info.present) return undefined;\n for (const env of envVars) {\n const bindingName = info.envToBinding.get(env);\n if (!bindingName) continue;\n const binding = info.bindings.get(bindingName);\n if (binding) return binding.origin;\n }\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2BA,MAAM,gBAAgB;;;;AA+CtB,SAAS,gBAAgB,OAIvB;CACA,MAAM,OAAO,cAAc,MAAM;CACjC,MAAM,QAAQ,OAAO,MAAM,QAAQ;AACnC,KAAI,SAAS,OAAO,UAAU,SAC5B,MAAK,MAAM,SAAS,OAAO,OAAO,MAAiC,EAAE;AACnE,MAAI,OAAO,UAAU,SAAU;EAC/B,MAAM,IAAI,MAAM,MAAM,cAAc;AACpC,MAAI,EACF,QAAO;GACL;GACA,QAAQ;GACR,KAAK;IAAE,MAAM,EAAE;IAAI,KAAK,EAAE;IAAI;GAC/B;;AAIP,QAAO;EAAE;EAAM,QAAQ;EAAY;;;;;;;AAQrC,SAAS,SAAY,UAA4B;CAC/C,IAAI;AACJ,KAAI;AACF,QAAM,GAAG,aAAa,UAAU,QAAQ;UACjC,KAAK;AACZ,MAAK,IAA8B,SAAS,SAAU,QAAO;AAC7D,QAAM;;AAER,KAAI;AACF,SAAQ,KAAK,KAAK,IAAI,IAAI,EAAE;UACrB,KAAK;AACZ,QAAM,IAAI,MACR,mBAAmB,KAAK,SAAS,SAAS,CAAC,IAAI,aAAa,IAAI,GACjE;;;;;;;;AASL,SAAgB,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AS;EACzB,MAAM,cAAc,KAAK,aAAa,IAAI,IAAI;AAC9C,MAAI,CAAC,YAAa;EAClB,MAAM,UAAU,KAAK,SAAS,IAAI,YAAY;AAC9C,MAAI,QAAS,QAAO,QAAQ"}
|
|
@@ -20,7 +20,7 @@ function checkWiring(info, targets) {
|
|
|
20
20
|
hint: `Declare resources.${binding.ref.type}.${binding.ref.key} in databricks.yml, or point the binding at an existing resource.`
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
for (const target of targets) for (const envVar of target.envVars) if (!info.
|
|
23
|
+
for (const target of targets) for (const envVar of target.envVars) if (!info.wiredEnvVars.has(envVar)) findings.push({
|
|
24
24
|
status: target.required ? "error" : "warn",
|
|
25
25
|
code: "ENV_UNWIRED",
|
|
26
26
|
label: envVar,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checks-wiring.js","names":[],"sources":["../../../../src/cli/commands/doctor/checks-wiring.ts"],"sourcesContent":["/**\n * Layer: wiring (offline, deploy-declaration). Validates the three-file join\n * that `databricks bundle validate` can't see, because it spans `app.yaml` and\n * the AppKit plugin layer:\n *\n * - every `app.yaml` `valueFrom: <name>` must match a `databricks.yml` binding\n * `name` — otherwise the platform has nothing to inject and the env var the\n * plugin reads stays empty at runtime;\n * - every bundle-managed `${resources.<type>.<key>.*}` binding must reference a\n * resource actually declared in the bundle — otherwise deploy fails.\n *\n * Runs regardless of auth; these are declaration problems, not connectivity.\n */\n\nimport type { BundleInfo } from \"./bundle\";\nimport type { ResourceTarget, WiringFinding } from \"./types\";\n\nexport function checkWiring(\n info: BundleInfo,\n targets: ResourceTarget[],\n): WiringFinding[] {\n if (!info.present) return [];\n\n const findings: WiringFinding[] = [];\n\n // 1. Each app.yaml valueFrom must resolve to a real binding.\n for (const [envVar, bindingName] of info.envToBinding) {\n if (!info.bindings.has(bindingName)) {\n findings.push({\n status: \"error\",\n code: \"VALUEFROM_UNBOUND\",\n label: envVar,\n detail: `app.yaml binds it to \"${bindingName}\", which databricks.yml doesn't declare`,\n hint: `Add a resource named \"${bindingName}\" under resources.apps.<app>.resources, or fix the valueFrom to match an existing binding.`,\n });\n }\n }\n\n // 2. Each bundle-managed binding must reference a declared bundle resource.\n for (const binding of info.bindings.values()) {\n if (binding.origin !== \"bundle-managed\" || !binding.ref) continue;\n const ref = `${binding.ref.type}.${binding.ref.key}`;\n if (!info.declaredResources.has(ref)) {\n findings.push({\n status: \"error\",\n code: \"BUNDLE_REF_MISSING\",\n label: binding.name,\n detail: `references \\${resources.${ref}.*}, but no resources.${binding.ref.type}.${binding.ref.key} is declared in the bundle`,\n hint: `Declare resources.${binding.ref.type}.${binding.ref.key} in databricks.yml, or point the binding at an existing resource.`,\n });\n }\n }\n\n // 3. A used plugin's env var with no app.yaml entry: set locally via .env, but\n // .env isn't uploaded and the platform injects only what app.yaml maps, so the\n // var is absent from the deployed app's environment — the headline \"works\n // locally, breaks on deploy\" case. For a *required* resource this guarantees a\n // broken deploy, so it's an error that gates the exit code; for an optional one\n // it's a warning.\n for (const target of targets) {\n for (const envVar of target.envVars) {\n if (!info.
|
|
1
|
+
{"version":3,"file":"checks-wiring.js","names":[],"sources":["../../../../src/cli/commands/doctor/checks-wiring.ts"],"sourcesContent":["/**\n * Layer: wiring (offline, deploy-declaration). Validates the three-file join\n * that `databricks bundle validate` can't see, because it spans `app.yaml` and\n * the AppKit plugin layer:\n *\n * - every `app.yaml` `valueFrom: <name>` must match a `databricks.yml` binding\n * `name` — otherwise the platform has nothing to inject and the env var the\n * plugin reads stays empty at runtime;\n * - every bundle-managed `${resources.<type>.<key>.*}` binding must reference a\n * resource actually declared in the bundle — otherwise deploy fails;\n * - every env var a used plugin reads must have an `app.yaml` entry, either\n * `valueFrom` or a literal `value` — otherwise it's unset once deployed.\n *\n * Runs regardless of auth; these are declaration problems, not connectivity.\n */\n\nimport type { BundleInfo } from \"./bundle\";\nimport type { ResourceTarget, WiringFinding } from \"./types\";\n\nexport function checkWiring(\n info: BundleInfo,\n targets: ResourceTarget[],\n): WiringFinding[] {\n if (!info.present) return [];\n\n const findings: WiringFinding[] = [];\n\n // 1. Each app.yaml valueFrom must resolve to a real binding.\n for (const [envVar, bindingName] of info.envToBinding) {\n if (!info.bindings.has(bindingName)) {\n findings.push({\n status: \"error\",\n code: \"VALUEFROM_UNBOUND\",\n label: envVar,\n detail: `app.yaml binds it to \"${bindingName}\", which databricks.yml doesn't declare`,\n hint: `Add a resource named \"${bindingName}\" under resources.apps.<app>.resources, or fix the valueFrom to match an existing binding.`,\n });\n }\n }\n\n // 2. Each bundle-managed binding must reference a declared bundle resource.\n for (const binding of info.bindings.values()) {\n if (binding.origin !== \"bundle-managed\" || !binding.ref) continue;\n const ref = `${binding.ref.type}.${binding.ref.key}`;\n if (!info.declaredResources.has(ref)) {\n findings.push({\n status: \"error\",\n code: \"BUNDLE_REF_MISSING\",\n label: binding.name,\n detail: `references \\${resources.${ref}.*}, but no resources.${binding.ref.type}.${binding.ref.key} is declared in the bundle`,\n hint: `Declare resources.${binding.ref.type}.${binding.ref.key} in databricks.yml, or point the binding at an existing resource.`,\n });\n }\n }\n\n // 3. A used plugin's env var with no app.yaml entry: set locally via .env, but\n // .env isn't uploaded and the platform injects only what app.yaml maps, so the\n // var is absent from the deployed app's environment — the headline \"works\n // locally, breaks on deploy\" case. For a *required* resource this guarantees a\n // broken deploy, so it's an error that gates the exit code; for an optional one\n // it's a warning.\n for (const target of targets) {\n for (const envVar of target.envVars) {\n if (!info.wiredEnvVars.has(envVar)) {\n findings.push({\n status: target.required ? \"error\" : \"warn\",\n code: \"ENV_UNWIRED\",\n label: envVar,\n detail: `has no app.yaml entry — it won't be set in the environment of the deployed app${\n target.required ? \"\" : \" (optional)\"\n }`,\n hint: `Add to app.yaml: \\`{ name: ${envVar}, valueFrom: <binding> }\\`, and declare that binding in databricks.yml.`,\n });\n }\n }\n }\n\n return findings;\n}\n"],"mappings":";AAmBA,SAAgB,YACd,MACA,SACiB;AACjB,KAAI,CAAC,KAAK,QAAS,QAAO,EAAE;CAE5B,MAAM,WAA4B,EAAE;AAGpC,MAAK,MAAM,CAAC,QAAQ,gBAAgB,KAAK,aACvC,KAAI,CAAC,KAAK,SAAS,IAAI,YAAY,CACjC,UAAS,KAAK;EACZ,QAAQ;EACR,MAAM;EACN,OAAO;EACP,QAAQ,yBAAyB,YAAY;EAC7C,MAAM,yBAAyB,YAAY;EAC5C,CAAC;AAKN,MAAK,MAAM,WAAW,KAAK,SAAS,QAAQ,EAAE;AAC5C,MAAI,QAAQ,WAAW,oBAAoB,CAAC,QAAQ,IAAK;EACzD,MAAM,MAAM,GAAG,QAAQ,IAAI,KAAK,GAAG,QAAQ,IAAI;AAC/C,MAAI,CAAC,KAAK,kBAAkB,IAAI,IAAI,CAClC,UAAS,KAAK;GACZ,QAAQ;GACR,MAAM;GACN,OAAO,QAAQ;GACf,QAAQ,2BAA2B,IAAI,wBAAwB,QAAQ,IAAI,KAAK,GAAG,QAAQ,IAAI,IAAI;GACnG,MAAM,qBAAqB,QAAQ,IAAI,KAAK,GAAG,QAAQ,IAAI,IAAI;GAChE,CAAC;;AAUN,MAAK,MAAM,UAAU,QACnB,MAAK,MAAM,UAAU,OAAO,QAC1B,KAAI,CAAC,KAAK,aAAa,IAAI,OAAO,CAChC,UAAS,KAAK;EACZ,QAAQ,OAAO,WAAW,UAAU;EACpC,MAAM;EACN,OAAO;EACP,QAAQ,iFACN,OAAO,WAAW,KAAK;EAEzB,MAAM,8BAA8B,OAAO;EAC5C,CAAC;AAKR,QAAO"}
|
|
@@ -56,8 +56,10 @@ var AppkitNotInstalledError = class extends Error {
|
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
58
|
/** Builds a Lakebase pool via `createLakebasePool`. Connection settings
|
|
59
|
-
* (`PGHOST`, `LAKEBASE_ENDPOINT`, …) come from the environment; we inject
|
|
60
|
-
*
|
|
59
|
+
* (`PGHOST`, `LAKEBASE_ENDPOINT`, …) come from the environment; we inject the
|
|
60
|
+
* resolved workspace client for OAuth token minting and the Postgres user,
|
|
61
|
+
* resolved like the app does at startup (`PGUSER`/`DATABRICKS_CLIENT_ID`, then
|
|
62
|
+
* `currentUser.me()`). */
|
|
61
63
|
async function getLakebasePool(client) {
|
|
62
64
|
const appkitPkg = "@databricks/appkit";
|
|
63
65
|
let appkit;
|
|
@@ -67,8 +69,11 @@ async function getLakebasePool(client) {
|
|
|
67
69
|
if (isModuleNotFound(err)) throw new AppkitNotInstalledError();
|
|
68
70
|
throw err;
|
|
69
71
|
}
|
|
72
|
+
const workspaceClient = client;
|
|
73
|
+
const user = await appkit.getUsernameWithApiLookup({ workspaceClient });
|
|
70
74
|
return appkit.createLakebasePool({
|
|
71
|
-
workspaceClient
|
|
75
|
+
workspaceClient,
|
|
76
|
+
user,
|
|
72
77
|
logger: { error: false }
|
|
73
78
|
});
|
|
74
79
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"databricks-client.js","names":[],"sources":["../../../../src/cli/commands/doctor/databricks-client.ts"],"sourcesContent":["/**\n * The seam where `appkit doctor` crosses into the Databricks SDK. It reaches\n * the SDK through the shared `workspace-client` facade — the one sanctioned SDK\n * import site — so no dynamic import or `noRestrictedImports` suppression is\n * needed. (The Lakebase probe still dynamically imports `@databricks/appkit`\n * below, since that's an optional peer `shared` deliberately doesn't depend on.)\n */\n\nimport {\n createWorkspaceClient,\n resolveProfile,\n type WorkspaceClient,\n} from \"../../../workspace-client\";\n\n/**\n * Retained for backward compatibility. Since `shared` now depends on the SDK\n * (reached via the workspace-client facade), the SDK is always resolvable at\n * runtime and this is no longer thrown; kept exported so existing callers and\n * the `SDK_NOT_INSTALLED` diagnostic branch keep compiling.\n */\nexport class SdkNotInstalledError extends Error {\n constructor() {\n super(\n \"The 'doctor' command requires the Databricks SDK (a dependency of @databricks/appkit).\",\n );\n this.name = \"SdkNotInstalledError\";\n }\n}\n\ninterface ServiceClientHandle {\n /** WorkspaceClient, typed as unknown to keep doctor's call sites SDK-agnostic. */\n client: unknown;\n}\n\nfunction isModuleNotFound(err: unknown): boolean {\n return (\n err instanceof Error &&\n (err.message.includes(\"Cannot find module\") ||\n err.message.includes(\"Cannot find package\") ||\n (err as NodeJS.ErrnoException).code === \"ERR_MODULE_NOT_FOUND\")\n );\n}\n\n/** Constructs a workspace client via the SDK's unified-auth chain. An explicit\n * `profile` is passed as a client option rather than mutating `process.env`, so\n * it doesn't leak beyond this call. */\nexport async function getServiceClient(\n profile?: string,\n): Promise<ServiceClientHandle> {\n const client = createWorkspaceClient(profile ? { profile } : {});\n return { client };\n}\n\n/**\n * The host a named profile declares in `~/.databrickscfg`, read offline. Doctor\n * uses it to detect a profile/host conflict, so it must not depend on the\n * resolved config (where `DATABRICKS_HOST` has already won). Returns undefined\n * for any unreadable file, missing profile, or hostless profile — a conflict we\n * can't prove isn't worth reporting.\n */\nexport async function getProfileHost(\n profile: string,\n): Promise<string | undefined> {\n try {\n // `disableEnv`: only the file's value counts; `DATABRICKS_HOST` already won.\n const { host } = await resolveProfile({ profile, disableEnv: true });\n return typeof host === \"string\" && host.length > 0 ? host : undefined;\n } catch {\n return undefined;\n }\n}\n\n/** Raised when `@databricks/appkit` (needed for the Lakebase probe) is absent. */\nexport class AppkitNotInstalledError extends Error {\n constructor() {\n super(\n \"The Lakebase connection check requires @databricks/appkit. Please install it to run this check.\",\n );\n this.name = \"AppkitNotInstalledError\";\n }\n}\n\n/** Minimal `pg.Pool`-shaped handle. The caller owns it and must call `end()`. */\nexport interface LakebasePoolHandle {\n query: (sql: string) => Promise<unknown>;\n end: () => Promise<void>;\n}\n\n/** Builds a Lakebase pool via `createLakebasePool`. Connection settings\n * (`PGHOST`, `LAKEBASE_ENDPOINT`, …) come from the environment; we inject
|
|
1
|
+
{"version":3,"file":"databricks-client.js","names":[],"sources":["../../../../src/cli/commands/doctor/databricks-client.ts"],"sourcesContent":["/**\n * The seam where `appkit doctor` crosses into the Databricks SDK. It reaches\n * the SDK through the shared `workspace-client` facade — the one sanctioned SDK\n * import site — so no dynamic import or `noRestrictedImports` suppression is\n * needed. (The Lakebase probe still dynamically imports `@databricks/appkit`\n * below, since that's an optional peer `shared` deliberately doesn't depend on.)\n */\n\nimport {\n createWorkspaceClient,\n resolveProfile,\n type WorkspaceClient,\n} from \"../../../workspace-client\";\n\n/**\n * Retained for backward compatibility. Since `shared` now depends on the SDK\n * (reached via the workspace-client facade), the SDK is always resolvable at\n * runtime and this is no longer thrown; kept exported so existing callers and\n * the `SDK_NOT_INSTALLED` diagnostic branch keep compiling.\n */\nexport class SdkNotInstalledError extends Error {\n constructor() {\n super(\n \"The 'doctor' command requires the Databricks SDK (a dependency of @databricks/appkit).\",\n );\n this.name = \"SdkNotInstalledError\";\n }\n}\n\ninterface ServiceClientHandle {\n /** WorkspaceClient, typed as unknown to keep doctor's call sites SDK-agnostic. */\n client: unknown;\n}\n\nfunction isModuleNotFound(err: unknown): boolean {\n return (\n err instanceof Error &&\n (err.message.includes(\"Cannot find module\") ||\n err.message.includes(\"Cannot find package\") ||\n (err as NodeJS.ErrnoException).code === \"ERR_MODULE_NOT_FOUND\")\n );\n}\n\n/** Constructs a workspace client via the SDK's unified-auth chain. An explicit\n * `profile` is passed as a client option rather than mutating `process.env`, so\n * it doesn't leak beyond this call. */\nexport async function getServiceClient(\n profile?: string,\n): Promise<ServiceClientHandle> {\n const client = createWorkspaceClient(profile ? { profile } : {});\n return { client };\n}\n\n/**\n * The host a named profile declares in `~/.databrickscfg`, read offline. Doctor\n * uses it to detect a profile/host conflict, so it must not depend on the\n * resolved config (where `DATABRICKS_HOST` has already won). Returns undefined\n * for any unreadable file, missing profile, or hostless profile — a conflict we\n * can't prove isn't worth reporting.\n */\nexport async function getProfileHost(\n profile: string,\n): Promise<string | undefined> {\n try {\n // `disableEnv`: only the file's value counts; `DATABRICKS_HOST` already won.\n const { host } = await resolveProfile({ profile, disableEnv: true });\n return typeof host === \"string\" && host.length > 0 ? host : undefined;\n } catch {\n return undefined;\n }\n}\n\n/** Raised when `@databricks/appkit` (needed for the Lakebase probe) is absent. */\nexport class AppkitNotInstalledError extends Error {\n constructor() {\n super(\n \"The Lakebase connection check requires @databricks/appkit. Please install it to run this check.\",\n );\n this.name = \"AppkitNotInstalledError\";\n }\n}\n\n/** Minimal `pg.Pool`-shaped handle. The caller owns it and must call `end()`. */\nexport interface LakebasePoolHandle {\n query: (sql: string) => Promise<unknown>;\n end: () => Promise<void>;\n}\n\n/** Builds a Lakebase pool via `createLakebasePool`. Connection settings\n * (`PGHOST`, `LAKEBASE_ENDPOINT`, …) come from the environment; we inject the\n * resolved workspace client for OAuth token minting and the Postgres user,\n * resolved like the app does at startup (`PGUSER`/`DATABRICKS_CLIENT_ID`, then\n * `currentUser.me()`). */\nexport async function getLakebasePool(\n client: unknown,\n): Promise<LakebasePoolHandle> {\n // A variable specifier stops TS from statically resolving `@databricks/appkit`,\n // an optional peer that `shared` has no dependency on.\n const appkitPkg = \"@databricks/appkit\";\n let appkit: {\n createLakebasePool: (cfg: Record<string, unknown>) => unknown;\n getUsernameWithApiLookup: (\n cfg: Record<string, unknown>,\n ) => Promise<string | undefined>;\n };\n try {\n appkit = await import(appkitPkg);\n } catch (err) {\n if (isModuleNotFound(err)) {\n throw new AppkitNotInstalledError();\n }\n throw err;\n }\n\n const workspaceClient = client as WorkspaceClient;\n const user = await appkit.getUsernameWithApiLookup({ workspaceClient });\n\n // Silence Lakebase's own logger. It defaults to an error-only console logger\n // that dumps the raw SDK ApiError (stack + full response blob) to stderr on a\n // failed token fetch. doctor classifies and prints that failure itself, so the\n // library's dump is just noise on top of our clean one-line report.\n // Lakebase takes the facade as is: it uses `request` and the typed `postgres`.\n const pool = appkit.createLakebasePool({\n workspaceClient,\n user,\n logger: { error: false },\n });\n return pool as unknown as LakebasePoolHandle;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAoBA,IAAa,uBAAb,cAA0C,MAAM;CAC9C,cAAc;AACZ,QACE,yFACD;AACD,OAAK,OAAO;;;AAShB,SAAS,iBAAiB,KAAuB;AAC/C,QACE,eAAe,UACd,IAAI,QAAQ,SAAS,qBAAqB,IACzC,IAAI,QAAQ,SAAS,sBAAsB,IAC1C,IAA8B,SAAS;;;;;AAO9C,eAAsB,iBACpB,SAC8B;AAE9B,QAAO,EAAE,QADM,sBAAsB,UAAU,EAAE,SAAS,GAAG,EAAE,CAAC,EAC/C;;;;;;;;;AAUnB,eAAsB,eACpB,SAC6B;AAC7B,KAAI;EAEF,MAAM,EAAE,SAAS,MAAM,eAAe;GAAE;GAAS,YAAY;GAAM,CAAC;AACpE,SAAO,OAAO,SAAS,YAAY,KAAK,SAAS,IAAI,OAAO;SACtD;AACN;;;;AAKJ,IAAa,0BAAb,cAA6C,MAAM;CACjD,cAAc;AACZ,QACE,kGACD;AACD,OAAK,OAAO;;;;;;;;AAehB,eAAsB,gBACpB,QAC6B;CAG7B,MAAM,YAAY;CAClB,IAAI;AAMJ,KAAI;AACF,WAAS,MAAM,OAAO;UACf,KAAK;AACZ,MAAI,iBAAiB,IAAI,CACvB,OAAM,IAAI,yBAAyB;AAErC,QAAM;;CAGR,MAAM,kBAAkB;CACxB,MAAM,OAAO,MAAM,OAAO,yBAAyB,EAAE,iBAAiB,CAAC;AAYvE,QALa,OAAO,mBAAmB;EACrC;EACA;EACA,QAAQ,EAAE,OAAO,OAAO;EACzB,CAAC"}
|
|
@@ -123,7 +123,7 @@ async function runDoctor(options) {
|
|
|
123
123
|
}
|
|
124
124
|
const configCtx = {
|
|
125
125
|
envFile: options.envFile ?? DEFAULT_ENV_FILE,
|
|
126
|
-
wiredEnvVars:
|
|
126
|
+
wiredEnvVars: bundle.wiredEnvVars
|
|
127
127
|
};
|
|
128
128
|
const setup = checkSetup(cwd, options);
|
|
129
129
|
const resources = await Promise.all(targets.map((target) => checkResourceSafe(target, client, configCtx)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","names":[],"sources":["../../../../src/cli/commands/doctor/run.ts"],"sourcesContent":["/** Orchestration for `appkit doctor`. */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { originForEnvVars, readBundleInfo } from \"./bundle\";\nimport {\n type ConfigCheckContext,\n checkAuth,\n checkConfig,\n DEFAULT_ENV_FILE,\n} from \"./checks\";\nimport { runExistenceProbe } from \"./checks-existence\";\nimport { checkWiring } from \"./checks-wiring\";\nimport {\n DEFAULT_MANIFEST_FILE,\n resolveTargetsFromCwd,\n} from \"./resolve-targets\";\nimport {\n AUTH_UNAVAILABLE_CODE,\n BUNDLE_MANAGED_CODE,\n type CheckStatus,\n type DoctorOptions,\n type DoctorReport,\n type LayerResult,\n type ResourceCheckResult,\n type ResourceTarget,\n type SetupFinding,\n STATUS_SEVERITY,\n} from \"./types\";\nimport { errorMessage, TimeoutError, withTimeout } from \"./utils\";\n\nfunction worst(a: CheckStatus, b: CheckStatus): CheckStatus {\n return STATUS_SEVERITY[b] > STATUS_SEVERITY[a] ? b : a;\n}\n\nasync function checkResource(\n target: ResourceTarget,\n // undefined = auth failed, so the live existence layer is skipped.\n client: unknown,\n configCtx: ConfigCheckContext,\n): Promise<ResourceCheckResult> {\n const layers: LayerResult[] = [];\n let rolled: CheckStatus = \"ok\";\n\n // A bundle-managed resource is checked before anything else, because neither\n // remaining layer can say anything true about it: its value comes from\n // `${resources.*}` at deploy time, so an unset env var locally is the *normal*\n // state (not a config error), and probing would be a false NOT_FOUND. A\n // mismatch between the three files is the wiring layer's job, and problems\n // inside databricks.yml are `databricks bundle validate`'s.\n //\n // This must run first: checking config here used to error on the unset var and\n // return early, never reaching this branch — which failed CI for a correctly\n // configured app while the report collapsed the row to a green-looking\n // \"will be created on deploy\" with the error hidden.\n if (target.origin === \"bundle-managed\") {\n return {\n target,\n status: \"skipped\",\n layers: [\n {\n layer: \"existence\",\n status: \"skipped\",\n code: BUNDLE_MANAGED_CODE,\n detail: \"created by this bundle on deploy — not probed\",\n },\n ],\n };\n }\n\n const configResult = checkConfig(target, configCtx);\n layers.push(configResult);\n rolled = worst(rolled, configResult.status);\n // A hard config failure makes the existence probe meaningless.\n if (configResult.status === \"error\") {\n return { target, status: rolled, layers };\n }\n\n if (client === undefined) {\n layers.push({\n layer: \"existence\",\n status: \"skipped\",\n code: AUTH_UNAVAILABLE_CODE,\n detail: \"skipped because workspace authentication failed\",\n });\n rolled = worst(rolled, \"skipped\");\n } else {\n // A reachable-but-unresponsive endpoint must not hang doctor, so bound the\n // probe; a timeout becomes an error row rather than a hung process.\n const result = await withTimeout(runExistenceProbe(client, target)).catch(\n (err): LayerResult => ({\n layer: \"existence\",\n status: \"error\",\n code: err instanceof TimeoutError ? \"PROBE_TIMEOUT\" : \"PROBE_FAILED\",\n detail: `probe did not complete: ${errorMessage(err)}`,\n }),\n );\n layers.push(result);\n rolled = worst(rolled, result.status);\n }\n\n return { target, status: rolled, layers };\n}\n\n/**\n * Runs {@link checkResource} behind a guaranteed boundary: any unexpected throw\n * (a probe's own `.catch` handles the common case, but this covers config\n * errors and anything else) becomes a single error row instead of rejecting the\n * `Promise.all` and losing the entire report to a stack trace.\n */\nasync function checkResourceSafe(\n target: ResourceTarget,\n client: unknown,\n configCtx: ConfigCheckContext,\n): Promise<ResourceCheckResult> {\n try {\n return await checkResource(target, client, configCtx);\n } catch (err) {\n return {\n target,\n status: \"error\",\n layers: [\n {\n layer: \"existence\",\n status: \"error\",\n code: \"PROBE_EXCEPTION\",\n detail: `unexpected error while checking: ${errorMessage(err)}`,\n },\n ],\n };\n }\n}\n\n/**\n * Checks doctor's own inputs, which otherwise produce a misleading report: run\n * from the wrong directory (say `server/` instead of the app root), nothing is\n * found and the result is a near-empty all-clear — a CI gate passing an app it\n * never looked at.\n *\n * The manifest is the signal for \"this is an app root\". Without it there's one\n * cause worth reporting (wrong directory), so it reports only that; a missing\n * `.env` would be noise on top. With it, a missing `.env` is worth its own notice\n * because local values could then only have come from the shell.\n *\n * Warnings, not errors: an app may legitimately have no `.env` (values exported\n * in the shell, or running in a deployed container), so this must not fail a\n * build on its own.\n */\nexport function checkSetup(\n cwd: string,\n options: DoctorOptions,\n): SetupFinding[] {\n // Presence of the manifest, not the target count: a manifest that declares no\n // resources is legitimate and shouldn't be reported as a missing file.\n if (!fs.existsSync(path.join(cwd, DEFAULT_MANIFEST_FILE))) {\n return [\n {\n status: \"warn\",\n code: \"NO_RESOURCES_CHECKED\",\n label: \"no resources checked\",\n detail: `no ${DEFAULT_MANIFEST_FILE} found in ${cwd}, so no plugin resources were checked`,\n hint: `Run doctor from the app root (where ${DEFAULT_MANIFEST_FILE} lives), or run \\`appkit plugin sync --write\\` if it's missing.`,\n },\n ];\n }\n\n // An explicit --env-file that's missing already throws in the CLI, so only the\n // auto-loaded default is worth reporting here.\n if (!options.envFile && !fs.existsSync(path.join(cwd, DEFAULT_ENV_FILE))) {\n return [\n {\n status: \"warn\",\n code: \"ENV_FILE_MISSING\",\n label: DEFAULT_ENV_FILE,\n detail: `no ${DEFAULT_ENV_FILE} found in ${cwd} — local values can only come from the shell`,\n hint: `Create one (see .env.example), or pass --env-file <path>.`,\n },\n ];\n }\n\n return [];\n}\n\nexport async function runDoctor(options: DoctorOptions): Promise<DoctorReport> {\n const { result: auth, client } = await checkAuth(options);\n\n // Resolve and config-check resources even when auth failed, so a bad\n // connection still surfaces config problems instead of hiding them.\n const cwd = process.cwd();\n const targets = resolveTargetsFromCwd(cwd);\n\n const bundle = readBundleInfo(cwd);\n for (const target of targets) {\n const origin = originForEnvVars(target.envVars, bundle);\n if (origin) target.origin = origin;\n }\n\n // Name the file local values actually came from, and let the config layer see\n // the deploy wiring so it doesn't advise fixing what's already correct.\n const configCtx: ConfigCheckContext = {\n envFile: options.envFile ?? DEFAULT_ENV_FILE,\n wiredEnvVars: new Set(bundle.envToBinding.keys()),\n };\n\n const setup = checkSetup(cwd, options);\n\n // Probes are independent reads; Promise.all preserves order for a\n // deterministic report.\n const resources = await Promise.all(\n targets.map((target) => checkResourceSafe(target, client, configCtx)),\n );\n const wiring = checkWiring(bundle, targets);\n\n // The summary counts *everything* with a status — resources, the auth check,\n // wiring findings, and setup notices — so a --json consumer reading\n // summary.error can trust it, and the human/JSON outputs share one source of\n // truth.\n const summary = { ok: 0, warn: 0, error: 0, skipped: 0 };\n for (const result of resources) summary[result.status] += 1;\n summary[auth.status] += 1;\n for (const finding of wiring) summary[finding.status] += 1;\n for (const finding of setup) summary[finding.status] += 1;\n\n const exitCode = summary.error > 0 ? 1 : 0;\n\n return { auth, resources, wiring, setup, summary, exitCode };\n}\n"],"mappings":";;;;;;;;;;;;AAgCA,SAAS,MAAM,GAAgB,GAA6B;AAC1D,QAAO,gBAAgB,KAAK,gBAAgB,KAAK,IAAI;;AAGvD,eAAe,cACb,QAEA,QACA,WAC8B;CAC9B,MAAM,SAAwB,EAAE;CAChC,IAAI,SAAsB;AAa1B,KAAI,OAAO,WAAW,iBACpB,QAAO;EACL;EACA,QAAQ;EACR,QAAQ,CACN;GACE,OAAO;GACP,QAAQ;GACR,MAAM;GACN,QAAQ;GACT,CACF;EACF;CAGH,MAAM,eAAe,YAAY,QAAQ,UAAU;AACnD,QAAO,KAAK,aAAa;AACzB,UAAS,MAAM,QAAQ,aAAa,OAAO;AAE3C,KAAI,aAAa,WAAW,QAC1B,QAAO;EAAE;EAAQ,QAAQ;EAAQ;EAAQ;AAG3C,KAAI,WAAW,QAAW;AACxB,SAAO,KAAK;GACV,OAAO;GACP,QAAQ;GACR,MAAM;GACN,QAAQ;GACT,CAAC;AACF,WAAS,MAAM,QAAQ,UAAU;QAC5B;EAGL,MAAM,SAAS,MAAM,YAAY,kBAAkB,QAAQ,OAAO,CAAC,CAAC,OACjE,SAAsB;GACrB,OAAO;GACP,QAAQ;GACR,MAAM,eAAe,eAAe,kBAAkB;GACtD,QAAQ,2BAA2B,aAAa,IAAI;GACrD,EACF;AACD,SAAO,KAAK,OAAO;AACnB,WAAS,MAAM,QAAQ,OAAO,OAAO;;AAGvC,QAAO;EAAE;EAAQ,QAAQ;EAAQ;EAAQ;;;;;;;;AAS3C,eAAe,kBACb,QACA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AM3C,MAAM,UAAU;EAAE,IAAI;EAAG,MAAM;EAAG,OAAO;EAAG,SAAS;EAAG;AACxD,MAAK,MAAM,UAAU,UAAW,SAAQ,OAAO,WAAW;AAC1D,SAAQ,KAAK,WAAW;AACxB,MAAK,MAAM,WAAW,OAAQ,SAAQ,QAAQ,WAAW;AACzD,MAAK,MAAM,WAAW,MAAO,SAAQ,QAAQ,WAAW;AAIxD,QAAO;EAAE;EAAM;EAAW;EAAQ;EAAO;EAAS,UAFjC,QAAQ,QAAQ,IAAI,IAAI;EAEmB"}
|
|
1
|
+
{"version":3,"file":"run.js","names":[],"sources":["../../../../src/cli/commands/doctor/run.ts"],"sourcesContent":["/** Orchestration for `appkit doctor`. */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { originForEnvVars, readBundleInfo } from \"./bundle\";\nimport {\n type ConfigCheckContext,\n checkAuth,\n checkConfig,\n DEFAULT_ENV_FILE,\n} from \"./checks\";\nimport { runExistenceProbe } from \"./checks-existence\";\nimport { checkWiring } from \"./checks-wiring\";\nimport {\n DEFAULT_MANIFEST_FILE,\n resolveTargetsFromCwd,\n} from \"./resolve-targets\";\nimport {\n AUTH_UNAVAILABLE_CODE,\n BUNDLE_MANAGED_CODE,\n type CheckStatus,\n type DoctorOptions,\n type DoctorReport,\n type LayerResult,\n type ResourceCheckResult,\n type ResourceTarget,\n type SetupFinding,\n STATUS_SEVERITY,\n} from \"./types\";\nimport { errorMessage, TimeoutError, withTimeout } from \"./utils\";\n\nfunction worst(a: CheckStatus, b: CheckStatus): CheckStatus {\n return STATUS_SEVERITY[b] > STATUS_SEVERITY[a] ? b : a;\n}\n\nasync function checkResource(\n target: ResourceTarget,\n // undefined = auth failed, so the live existence layer is skipped.\n client: unknown,\n configCtx: ConfigCheckContext,\n): Promise<ResourceCheckResult> {\n const layers: LayerResult[] = [];\n let rolled: CheckStatus = \"ok\";\n\n // A bundle-managed resource is checked before anything else, because neither\n // remaining layer can say anything true about it: its value comes from\n // `${resources.*}` at deploy time, so an unset env var locally is the *normal*\n // state (not a config error), and probing would be a false NOT_FOUND. A\n // mismatch between the three files is the wiring layer's job, and problems\n // inside databricks.yml are `databricks bundle validate`'s.\n //\n // This must run first: checking config here used to error on the unset var and\n // return early, never reaching this branch — which failed CI for a correctly\n // configured app while the report collapsed the row to a green-looking\n // \"will be created on deploy\" with the error hidden.\n if (target.origin === \"bundle-managed\") {\n return {\n target,\n status: \"skipped\",\n layers: [\n {\n layer: \"existence\",\n status: \"skipped\",\n code: BUNDLE_MANAGED_CODE,\n detail: \"created by this bundle on deploy — not probed\",\n },\n ],\n };\n }\n\n const configResult = checkConfig(target, configCtx);\n layers.push(configResult);\n rolled = worst(rolled, configResult.status);\n // A hard config failure makes the existence probe meaningless.\n if (configResult.status === \"error\") {\n return { target, status: rolled, layers };\n }\n\n if (client === undefined) {\n layers.push({\n layer: \"existence\",\n status: \"skipped\",\n code: AUTH_UNAVAILABLE_CODE,\n detail: \"skipped because workspace authentication failed\",\n });\n rolled = worst(rolled, \"skipped\");\n } else {\n // A reachable-but-unresponsive endpoint must not hang doctor, so bound the\n // probe; a timeout becomes an error row rather than a hung process.\n const result = await withTimeout(runExistenceProbe(client, target)).catch(\n (err): LayerResult => ({\n layer: \"existence\",\n status: \"error\",\n code: err instanceof TimeoutError ? \"PROBE_TIMEOUT\" : \"PROBE_FAILED\",\n detail: `probe did not complete: ${errorMessage(err)}`,\n }),\n );\n layers.push(result);\n rolled = worst(rolled, result.status);\n }\n\n return { target, status: rolled, layers };\n}\n\n/**\n * Runs {@link checkResource} behind a guaranteed boundary: any unexpected throw\n * (a probe's own `.catch` handles the common case, but this covers config\n * errors and anything else) becomes a single error row instead of rejecting the\n * `Promise.all` and losing the entire report to a stack trace.\n */\nasync function checkResourceSafe(\n target: ResourceTarget,\n client: unknown,\n configCtx: ConfigCheckContext,\n): Promise<ResourceCheckResult> {\n try {\n return await checkResource(target, client, configCtx);\n } catch (err) {\n return {\n target,\n status: \"error\",\n layers: [\n {\n layer: \"existence\",\n status: \"error\",\n code: \"PROBE_EXCEPTION\",\n detail: `unexpected error while checking: ${errorMessage(err)}`,\n },\n ],\n };\n }\n}\n\n/**\n * Checks doctor's own inputs, which otherwise produce a misleading report: run\n * from the wrong directory (say `server/` instead of the app root), nothing is\n * found and the result is a near-empty all-clear — a CI gate passing an app it\n * never looked at.\n *\n * The manifest is the signal for \"this is an app root\". Without it there's one\n * cause worth reporting (wrong directory), so it reports only that; a missing\n * `.env` would be noise on top. With it, a missing `.env` is worth its own notice\n * because local values could then only have come from the shell.\n *\n * Warnings, not errors: an app may legitimately have no `.env` (values exported\n * in the shell, or running in a deployed container), so this must not fail a\n * build on its own.\n */\nexport function checkSetup(\n cwd: string,\n options: DoctorOptions,\n): SetupFinding[] {\n // Presence of the manifest, not the target count: a manifest that declares no\n // resources is legitimate and shouldn't be reported as a missing file.\n if (!fs.existsSync(path.join(cwd, DEFAULT_MANIFEST_FILE))) {\n return [\n {\n status: \"warn\",\n code: \"NO_RESOURCES_CHECKED\",\n label: \"no resources checked\",\n detail: `no ${DEFAULT_MANIFEST_FILE} found in ${cwd}, so no plugin resources were checked`,\n hint: `Run doctor from the app root (where ${DEFAULT_MANIFEST_FILE} lives), or run \\`appkit plugin sync --write\\` if it's missing.`,\n },\n ];\n }\n\n // An explicit --env-file that's missing already throws in the CLI, so only the\n // auto-loaded default is worth reporting here.\n if (!options.envFile && !fs.existsSync(path.join(cwd, DEFAULT_ENV_FILE))) {\n return [\n {\n status: \"warn\",\n code: \"ENV_FILE_MISSING\",\n label: DEFAULT_ENV_FILE,\n detail: `no ${DEFAULT_ENV_FILE} found in ${cwd} — local values can only come from the shell`,\n hint: `Create one (see .env.example), or pass --env-file <path>.`,\n },\n ];\n }\n\n return [];\n}\n\nexport async function runDoctor(options: DoctorOptions): Promise<DoctorReport> {\n const { result: auth, client } = await checkAuth(options);\n\n // Resolve and config-check resources even when auth failed, so a bad\n // connection still surfaces config problems instead of hiding them.\n const cwd = process.cwd();\n const targets = resolveTargetsFromCwd(cwd);\n\n const bundle = readBundleInfo(cwd);\n for (const target of targets) {\n const origin = originForEnvVars(target.envVars, bundle);\n if (origin) target.origin = origin;\n }\n\n // Name the file local values actually came from, and let the config layer see\n // the deploy wiring so it doesn't advise fixing what's already correct.\n const configCtx: ConfigCheckContext = {\n envFile: options.envFile ?? DEFAULT_ENV_FILE,\n wiredEnvVars: bundle.wiredEnvVars,\n };\n\n const setup = checkSetup(cwd, options);\n\n // Probes are independent reads; Promise.all preserves order for a\n // deterministic report.\n const resources = await Promise.all(\n targets.map((target) => checkResourceSafe(target, client, configCtx)),\n );\n const wiring = checkWiring(bundle, targets);\n\n // The summary counts *everything* with a status — resources, the auth check,\n // wiring findings, and setup notices — so a --json consumer reading\n // summary.error can trust it, and the human/JSON outputs share one source of\n // truth.\n const summary = { ok: 0, warn: 0, error: 0, skipped: 0 };\n for (const result of resources) summary[result.status] += 1;\n summary[auth.status] += 1;\n for (const finding of wiring) summary[finding.status] += 1;\n for (const finding of setup) summary[finding.status] += 1;\n\n const exitCode = summary.error > 0 ? 1 : 0;\n\n return { auth, resources, wiring, setup, summary, exitCode };\n}\n"],"mappings":";;;;;;;;;;;;AAgCA,SAAS,MAAM,GAAgB,GAA6B;AAC1D,QAAO,gBAAgB,KAAK,gBAAgB,KAAK,IAAI;;AAGvD,eAAe,cACb,QAEA,QACA,WAC8B;CAC9B,MAAM,SAAwB,EAAE;CAChC,IAAI,SAAsB;AAa1B,KAAI,OAAO,WAAW,iBACpB,QAAO;EACL;EACA,QAAQ;EACR,QAAQ,CACN;GACE,OAAO;GACP,QAAQ;GACR,MAAM;GACN,QAAQ;GACT,CACF;EACF;CAGH,MAAM,eAAe,YAAY,QAAQ,UAAU;AACnD,QAAO,KAAK,aAAa;AACzB,UAAS,MAAM,QAAQ,aAAa,OAAO;AAE3C,KAAI,aAAa,WAAW,QAC1B,QAAO;EAAE;EAAQ,QAAQ;EAAQ;EAAQ;AAG3C,KAAI,WAAW,Q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AAU,sBAAsB,IAAI;CAE1C,MAAM,SAAS,eAAe,IAAI;AAClC,MAAK,MAAM,UAAU,SAAS;EAC5B,MAAM,SAAS,iBAAiB,OAAO,SAAS,OAAO;AACvD,MAAI,OAAQ,QAAO,SAAS;;CAK9B,MAAM,YAAgC;EACpC,SAAS,QAAQ,WAAW;EAC5B,cAAc,OAAO;EACtB;CAED,MAAM,QAAQ,WAAW,KAAK,QAAQ;CAItC,MAAM,YAAY,MAAM,QAAQ,IAC9B,QAAQ,KAAK,WAAW,kBAAkB,QAAQ,QAAQ,UAAU,CAAC,CACtE;CACD,MAAM,SAAS,YAAY,QAAQ,QAAQ;CAM3C,MAAM,UAAU;EAAE,IAAI;EAAG,MAAM;EAAG,OAAO;EAAG,SAAS;EAAG;AACxD,MAAK,MAAM,UAAU,UAAW,SAAQ,OAAO,WAAW;AAC1D,SAAQ,KAAK,WAAW;AACxB,MAAK,MAAM,WAAW,OAAQ,SAAQ,QAAQ,WAAW;AACzD,MAAK,MAAM,WAAW,MAAO,SAAQ,QAAQ,WAAW;AAIxD,QAAO;EAAE;EAAM;EAAW;EAAQ;EAAO;EAAS,UAFjC,QAAQ,QAAQ,IAAI,IAAI;EAEmB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../../src/react/charts/area/index.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../../src/react/charts/area/index.tsx"],"mappings":";;;;;;;AAYA;;;;;;cAAa,SAAA;EAAA,QAA4D,cAAA,GAAA,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/react/charts/area/index.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/react/charts/area/index.tsx"],"sourcesContent":["import { createChart } from \"../create-chart\";\nimport type { AreaChartProps } from \"../types\";\n\n/**\n * Area Chart component for trend visualization with filled areas.\n *\n * **Important:** This component uses Apache ECharts architecture. Configure it via props, not by passing child components.\n *\n * **Best Practice:** Use the built-in data fetching by passing `queryKey` and `parameters` props instead of pre-fetching data with `useAnalyticsQuery`.\n *\n * Supports both query mode (queryKey + parameters) and data mode (static data).\n */\nexport const AreaChart = createChart<AreaChartProps>(\"area\", \"AreaChart\");\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,YAAY,YAA4B,QAAQ,YAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../../src/react/charts/bar/index.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../../src/react/charts/bar/index.tsx"],"mappings":";;;;;;;AAYA;;;;;;cAAa,QAAA;EAAA,QAAwD,aAAA,GAAA,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/react/charts/bar/index.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/react/charts/bar/index.tsx"],"sourcesContent":["import { createChart } from \"../create-chart\";\nimport type { BarChartProps } from \"../types\";\n\n/**\n * Bar Chart component for categorical comparisons.\n *\n * **Important:** This component uses Apache ECharts architecture. Configure it via props, not by passing child components.\n *\n * **Best Practice:** Use the built-in data fetching by passing `queryKey` and `parameters` props instead of pre-fetching data with `useAnalyticsQuery`.\n *\n * Supports both query mode (queryKey + parameters) and data mode (static data).\n */\nexport const BarChart = createChart<BarChartProps>(\"bar\", \"BarChart\");\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,WAAW,YAA2B,OAAO,WAAW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../../src/react/charts/heatmap/index.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../../src/react/charts/heatmap/index.tsx"],"mappings":";;;;;;;AAiBA;;;;;;;;;;;cAAa,YAAA;EAAA,QAGZ,iBAAA,GAAA,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/react/charts/heatmap/index.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/react/charts/heatmap/index.tsx"],"sourcesContent":["import { createChart } from \"../create-chart\";\nimport type { HeatmapChartProps } from \"../types\";\n\n/**\n * Heatmap Chart component for matrix-style data visualization.\n *\n * **Important:** This component uses Apache ECharts architecture. Configure it via props, not by passing child components.\n *\n * **Best Practice:** Use the built-in data fetching by passing `queryKey` and `parameters` props instead of pre-fetching data with `useAnalyticsQuery`.\n *\n * Data should be in \"long format\" with three fields:\n * - xKey: X-axis category (columns)\n * - yAxisKey: Y-axis category (rows)\n * - yKey: The numeric value for each cell\n *\n * Supports both query mode (queryKey + parameters) and data mode (static data).\n */\nexport const HeatmapChart = createChart<HeatmapChartProps>(\n \"heatmap\",\n \"HeatmapChart\",\n);\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,MAAa,eAAe,YAC1B,WACA,eACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../../src/react/charts/line/index.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../../src/react/charts/line/index.tsx"],"mappings":";;;;;;;AAYA;;;;;;cAAa,SAAA;EAAA,QAA4D,cAAA,GAAA,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/react/charts/line/index.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/react/charts/line/index.tsx"],"sourcesContent":["import { createChart } from \"../create-chart\";\nimport type { LineChartProps } from \"../types\";\n\n/**\n * Line Chart component for time-series and trend visualization.\n *\n * **Important:** This component uses Apache ECharts architecture. Configure it via props, not by passing child components.\n *\n * **Best Practice:** Use the built-in data fetching by passing `queryKey` and `parameters` props instead of pre-fetching data with `useAnalyticsQuery`.\n *\n * Supports both query mode (queryKey + parameters) and data mode (static data).\n */\nexport const LineChart = createChart<LineChartProps>(\"line\", \"LineChart\");\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,YAAY,YAA4B,QAAQ,YAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../../src/react/charts/pie/index.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../../src/react/charts/pie/index.tsx"],"mappings":";;;;;;;AAYA;;;;;;cAAa,QAAA;EAAA,QAAwD,aAAA,GAAA,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;AAWrE;;;;;;;;cAAa,UAAA;EAAA,QAAgE,eAAA,GAAA,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/react/charts/pie/index.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/react/charts/pie/index.tsx"],"sourcesContent":["import { createChart } from \"../create-chart\";\nimport type { DonutChartProps, PieChartProps } from \"../types\";\n\n/**\n * Pie Chart component for proportional data visualization.\n *\n * **Important:** This component uses Apache ECharts architecture. Configure it via props, not by passing child components.\n *\n * **Best Practice:** Use the built-in data fetching by passing `queryKey` and `parameters` props instead of pre-fetching data with `useAnalyticsQuery`.\n *\n * Supports both query mode (queryKey + parameters) and data mode (static data).\n */\nexport const PieChart = createChart<PieChartProps>(\"pie\", \"PieChart\");\n\n/**\n * Donut Chart component (Pie chart with inner radius).\n *\n * **Important:** This component uses Apache ECharts architecture. Configure it via props, not by passing child components.\n *\n * **Best Practice:** Use the built-in data fetching by passing `queryKey` and `parameters` props instead of pre-fetching data with `useAnalyticsQuery`.\n *\n * Supports both query mode (queryKey + parameters) and data mode (static data).\n */\nexport const DonutChart = createChart<DonutChartProps>(\"donut\", \"DonutChart\");\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,WAAW,YAA2B,OAAO,WAAW;;;;;;;;;;AAWrE,MAAa,aAAa,YAA6B,SAAS,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../../src/react/charts/radar/index.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../../src/react/charts/radar/index.tsx"],"mappings":";;;;;;;AAYA;;;;;;cAAa,UAAA;EAAA,QAAgE,eAAA,GAAA,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/react/charts/radar/index.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/react/charts/radar/index.tsx"],"sourcesContent":["import { createChart } from \"../create-chart\";\nimport type { RadarChartProps } from \"../types\";\n\n/**\n * Radar Chart component for multi-dimensional data comparison.\n *\n * **Important:** This component uses Apache ECharts architecture. Configure it via props, not by passing child components.\n *\n * **Best Practice:** Use the built-in data fetching by passing `queryKey` and `parameters` props instead of pre-fetching data with `useAnalyticsQuery`.\n *\n * Supports both query mode (queryKey + parameters) and data mode (static data).\n */\nexport const RadarChart = createChart<RadarChartProps>(\"radar\", \"RadarChart\");\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,aAAa,YAA6B,SAAS,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../../src/react/charts/scatter/index.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../../src/react/charts/scatter/index.tsx"],"mappings":";;;;;;;AAYA;;;;;;cAAa,YAAA;EAAA,QAGZ,iBAAA,GAAA,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/react/charts/scatter/index.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/react/charts/scatter/index.tsx"],"sourcesContent":["import { createChart } from \"../create-chart\";\nimport type { ScatterChartProps } from \"../types\";\n\n/**\n * Scatter Chart component for correlation and distribution visualization.\n *\n * **Important:** This component uses Apache ECharts architecture. Configure it via props, not by passing child components.\n *\n * **Best Practice:** Use the built-in data fetching by passing `queryKey` and `parameters` props instead of pre-fetching data with `useAnalyticsQuery`.\n *\n * Supports both query mode (queryKey + parameters) and data mode (static data).\n */\nexport const ScatterChart = createChart<ScatterChartProps>(\n \"scatter\",\n \"ScatterChart\",\n);\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,eAAe,YAC1B,WACA,eACD"}
|