@askdb/studio 0.2.0-beta.4 → 0.2.0-beta.40
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/README.md +33 -29
- package/bin/askdb-studio.js +3 -1
- package/dist/bin.d.ts +1 -1
- package/dist/bin.d.ts.map +1 -1
- package/dist/bin.js +24 -3
- package/dist/bin.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +72 -15
- package/dist/cli.js.map +1 -1
- package/dist/client/assets/index-CgbreUa6.js +100 -0
- package/dist/client/assets/index-DpkWiK_X.css +2 -0
- package/dist/client/index.html +2 -2
- package/dist/execute-registry.d.ts +89 -0
- package/dist/execute-registry.d.ts.map +1 -0
- package/dist/execute-registry.js +445 -0
- package/dist/execute-registry.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/introspection.d.ts +35 -0
- package/dist/introspection.d.ts.map +1 -0
- package/dist/introspection.js +106 -0
- package/dist/introspection.js.map +1 -0
- package/dist/package-manager.d.ts +44 -0
- package/dist/package-manager.d.ts.map +1 -0
- package/dist/package-manager.js +86 -0
- package/dist/package-manager.js.map +1 -0
- package/dist/prisma-install.d.ts +7 -0
- package/dist/prisma-install.d.ts.map +1 -0
- package/dist/prisma-install.js +7 -0
- package/dist/prisma-install.js.map +1 -0
- package/dist/request-guard.d.ts +44 -0
- package/dist/request-guard.d.ts.map +1 -0
- package/dist/request-guard.js +170 -0
- package/dist/request-guard.js.map +1 -0
- package/dist/server.d.ts +22 -4
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +1123 -148
- package/dist/server.js.map +1 -1
- package/dist/setup.d.ts +77 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +511 -0
- package/dist/setup.js.map +1 -0
- package/dist/shared/api.d.ts +176 -3
- package/dist/shared/api.d.ts.map +1 -1
- package/package.json +80 -30
- package/dist/client/assets/index-Bsn2S5X2.css +0 -2
- package/dist/client/assets/index-C_RfRKkd.js +0 -8
package/README.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# @askdb/studio
|
|
2
2
|
|
|
3
|
-
Local React browser UI for editing AskDB Schema v2 enrichment, checking RAG
|
|
4
|
-
retrieval, and generating sample NL-to-SQL output.
|
|
3
|
+
Local React browser UI for editing AskDB Schema v2 enrichment, checking RAG retrieval, and generating sample NL-to-SQL output.
|
|
5
4
|
|
|
6
5
|
```sh
|
|
7
6
|
askdb-studio --schema ./my-app.schema
|
|
@@ -9,21 +8,32 @@ askdb-studio --schema ./my-app.schema
|
|
|
9
8
|
askdb studio --schema ./my-app.schema
|
|
10
9
|
```
|
|
11
10
|
|
|
12
|
-
Studio serves a local web app at `http://127.0.0.1:5556` by default. The
|
|
13
|
-
published package contains a Node local server plus a Vite-built React client.
|
|
14
|
-
It can:
|
|
11
|
+
Studio serves a local web app at `http://127.0.0.1:5556` by default. The published package contains a Node local server plus a Vite-built React client. It can:
|
|
15
12
|
|
|
16
13
|
- browse all physical tables and columns in `schema.json`
|
|
17
14
|
- edit table descriptions, aliases, primary entities, tags, common query language, example questions, and column metadata
|
|
18
15
|
- write the describable layer back to `tables/*.md`
|
|
19
|
-
- request AI enrichment suggestions when `
|
|
16
|
+
- request AI enrichment suggestions when the `ai` block in `askdb.config.*` has an API key
|
|
20
17
|
- build and query the configured RAG index (`memory`, file-backed, or `pgvector`)
|
|
21
18
|
- generate sample Postgres SQL for natural-language questions against the currently saved enrichment
|
|
19
|
+
- define and manage multi-tenancy policy (tenant roots, hierarchy, scoped/polymorphic/global tables) via the Tenancy view
|
|
20
|
+
- draft tenant policy with AI assistance
|
|
21
|
+
- test NL→SQL with tenant scope controls and SQL output modes (`sql-only` vs `sql-params`)
|
|
22
22
|
|
|
23
|
-
Studio
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
Schema browsing, enrichment, and SQL generation do not require a database driver. The optional Playground execute path runs generated SQL against a live database. Studio supports Postgres, MySQL, SQLite, and SQL Server. Each dialect requires its own optional peer driver package — install only the one you need:
|
|
24
|
+
|
|
25
|
+
| Dialect | Package |
|
|
26
|
+
|---|---|
|
|
27
|
+
| Postgres | `pnpm add pg` |
|
|
28
|
+
| MySQL | `pnpm add mysql2` |
|
|
29
|
+
| SQLite | `pnpm add better-sqlite3` |
|
|
30
|
+
| SQL Server | `pnpm add mssql` |
|
|
31
|
+
|
|
32
|
+
Execute is off by default. Enable it with `studio.execute.enabled: true` plus an execute connection (`studio.execute.databaseUrl`, or `file` for SQLite), ideally a read-only database role. Studio only reuses the introspection connection when `studio.execute.useIntrospectionConnection` is `true`. Each query is validated as a single read-only SELECT and runs in a read-only (SQL Server: always-rolled-back) transaction with a timeout (`studio.execute.timeoutMs`, default 30 s) and a row cap (`studio.execute.maxRows`, default 500).
|
|
33
|
+
|
|
34
|
+
The execute provider is resolved from `studio.execute.provider` in `askdb.config.ts`, falling back to the active introspection provider, then defaulting to Postgres for backward compatibility. The Playground displays the configured provider, connection status, and driver readiness near the Execute button. When running locally, Studio can install the missing driver for you.
|
|
35
|
+
|
|
36
|
+
Studio uses `@askdb/enrich` for the shared non-UI Schema v2 authoring logic: workspace loading, editable drafts, markdown/frontmatter preservation, save helpers, and suggestion context.
|
|
27
37
|
|
|
28
38
|
## Development
|
|
29
39
|
|
|
@@ -33,30 +43,24 @@ pnpm --filter @askdb/studio test
|
|
|
33
43
|
pnpm --filter @askdb/studio start -- --schema ../../fixtures/schemas/orders-users.schema
|
|
34
44
|
```
|
|
35
45
|
|
|
36
|
-
The client source lives in `src/web/` and builds to `dist/client/`. The server
|
|
37
|
-
source lives in `src/` and serves the compiled client assets from that directory.
|
|
46
|
+
The client source lives in `src/web/` and builds to `dist/client/`. The server source lives in `src/` and serves the compiled client assets from that directory.
|
|
38
47
|
|
|
39
|
-
The React client is styled with Tailwind CSS and shadcn-style primitives. The
|
|
40
|
-
requested shadcn preset is recorded in `components.json`:
|
|
48
|
+
The React client is styled with Tailwind CSS and shadcn-style primitives. The requested shadcn preset is recorded in `components.json`:
|
|
41
49
|
|
|
42
50
|
```sh
|
|
43
51
|
pnpm dlx shadcn@latest init --preset b1D0eCA4
|
|
44
52
|
```
|
|
45
53
|
|
|
46
|
-
|
|
54
|
+
Configuration, in `askdb.config.*` (bind any value to an environment variable of your choosing with `env("NAME")`; Studio loads `.env` first):
|
|
47
55
|
|
|
48
|
-
|
|
|
56
|
+
| Config key | Purpose |
|
|
49
57
|
| --- | --- |
|
|
50
|
-
| `
|
|
51
|
-
| `
|
|
52
|
-
| `
|
|
53
|
-
| `
|
|
54
|
-
| `
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
Studio uses the active `rag.store` branch from `askdb.config.*`. For `pgvector`,
|
|
61
|
-
make sure the configured table/extension already exist and `ASKDB_PGVECTOR_URL`
|
|
62
|
-
resolves correctly.
|
|
58
|
+
| `ai.provider`, `ai.providerConfig.<provider>.apiKey` | Enables AI suggestions and sample NL-to-SQL generation. |
|
|
59
|
+
| `ai.providerConfig.<provider>.baseUrl` | Optional base URL, e.g. an OpenAI-compatible endpoint. |
|
|
60
|
+
| `studio.listen.host` | Bind host. Defaults to `127.0.0.1`. `--host` overrides it. |
|
|
61
|
+
| `studio.listen.port` | Bind port. Defaults to `5556`. `--port` overrides it. |
|
|
62
|
+
| `dev.mockSql` | Deterministic generated SQL for tests or offline demos. |
|
|
63
|
+
|
|
64
|
+
Security: every `/api/*` request must carry the per-launch session token that Studio injects into the page it serves (`x-askdb-studio-token` header), come with an allowed `Host` (`localhost`, `127.0.0.1`, `[::1]`, or the bound host), and, for writes, be same-origin JSON. Programmatic callers of `createStudioServer()` can read the token from `server.sessionToken`. Binding to a non-loopback host exposes query execution and schema writes to anyone on that network who can load the page. Only do that on a trusted network. See [Studio → Security model](https://askdb.tools/studio/#security-model).
|
|
65
|
+
|
|
66
|
+
Studio uses the active `rag.store` branch from `askdb.config.*`, and embeds with `rag.embedder`: `mock`, a local lexical embedder that needs no key, or `ai`, the `ai.embedding` model, built from that section's connection only (see the [configuration reference](https://askdb.tools/reference/config/#aiembedding)). For `pgvector`, make sure `rag.storeConfig.pgvector.databaseUrl` resolves; there's no need to create the table. The first index build creates it, and the `vector` extension, at the width the embedding model returns (or `ai.embedding.dimensions`). A table that already exists at another width is refused, with a message saying how to resolve it. If Studio's database role can't create extensions, create `vector` first.
|
package/bin/askdb-studio.js
CHANGED
package/dist/bin.d.ts
CHANGED
package/dist/bin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAKA,wBAAsB,YAAY,CAAC,IAAI,GAAE,SAAS,MAAM,EAA0B,GAAG,OAAO,CAAC,MAAM,CAAC,CAmBnG"}
|
package/dist/bin.js
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { bootstrapAskDbEnv } from "@askdb/config";
|
|
2
|
+
import { bootstrapAskDbEnv, discoverAskDbConfigPath } from "@askdb/config";
|
|
3
|
+
import { pathToFileURL } from "node:url";
|
|
3
4
|
import { runStudioCli } from "./cli.js";
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
export async function runStudioBin(argv = process.argv.slice(2)) {
|
|
6
|
+
const cwd = process.cwd();
|
|
7
|
+
const configPath = discoverAskDbConfigPath(cwd);
|
|
8
|
+
// No config yet: Studio starts in setup mode and the browser wizard walks the user through
|
|
9
|
+
// creating one. runStudioCli re-probes.
|
|
10
|
+
if (configPath) {
|
|
11
|
+
try {
|
|
12
|
+
bootstrapAskDbEnv({ cwd });
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
// A config that exists but fails to load (a syntax error, or dependencies not installed
|
|
16
|
+
// yet) still lets Studio start so setup can continue, but the user must hear why their
|
|
17
|
+
// settings are ignored. Setup never overwrites an existing config file.
|
|
18
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
19
|
+
process.stderr.write(`askdb-studio: warning: ${configPath} could not be loaded, so Studio is ignoring it: ${message}\n`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return runStudioCli(argv);
|
|
23
|
+
}
|
|
24
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
25
|
+
process.exit(await runStudioBin());
|
|
26
|
+
}
|
|
6
27
|
//# sourceMappingURL=bin.js.map
|
package/dist/bin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAA0B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAChF,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1B,MAAM,UAAU,GAAG,uBAAuB,CAAC,GAAG,CAAC,CAAC;IAChD,2FAA2F;IAC3F,wCAAwC;IACxC,IAAI,UAAU,EAAE,CAAC;QACf,IAAI,CAAC;YACH,iBAAiB,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;QAC7B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,wFAAwF;YACxF,uFAAuF;YACvF,wEAAwE;YACxE,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,0BAA0B,UAAU,mDAAmD,OAAO,IAAI,CACnG,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC;AAED,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC/E,OAAO,CAAC,IAAI,CAAC,MAAM,YAAY,EAAE,CAAC,CAAC;AACrC,CAAC"}
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAqBA,wBAAsB,YAAY,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAkE3E"}
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { DEFAULT_INTROSPECT_OUTPUT_DIR, getAskDbRuntimeConfig } from "@askdb/config";
|
|
2
|
-
import { readFileSync } from "node:fs";
|
|
1
|
+
import { DEFAULT_INTROSPECT_OUTPUT_DIR, discoverAskDbConfigPath, getAskDbRuntimeConfig, } from "@askdb/config";
|
|
2
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3
3
|
import { networkInterfaces } from "node:os";
|
|
4
|
+
import { resolve } from "node:path";
|
|
5
|
+
import { isLoopbackHost } from "./request-guard.js";
|
|
4
6
|
import { createStudioServer } from "./server.js";
|
|
5
7
|
export async function runStudioCli(argv) {
|
|
6
8
|
let opts;
|
|
@@ -20,18 +22,25 @@ export async function runStudioCli(argv) {
|
|
|
20
22
|
printHelp(process.stdout);
|
|
21
23
|
return 0;
|
|
22
24
|
}
|
|
25
|
+
const setupReason = resolveSetupReason(opts);
|
|
23
26
|
let server;
|
|
24
27
|
try {
|
|
25
28
|
server = createStudioServer({
|
|
26
29
|
schema: opts.schema,
|
|
27
30
|
host: opts.host,
|
|
28
31
|
port: opts.port,
|
|
32
|
+
setupReason,
|
|
29
33
|
});
|
|
30
34
|
}
|
|
31
35
|
catch (error) {
|
|
32
36
|
process.stderr.write(`askdb-studio: ${formatError(error)}\n`);
|
|
33
37
|
return 1;
|
|
34
38
|
}
|
|
39
|
+
if (setupReason) {
|
|
40
|
+
process.stdout.write(setupReason === "no-config"
|
|
41
|
+
? "No askdb.config.* found — Studio will open with the guided setup wizard.\n"
|
|
42
|
+
: "No schema artifact found — Studio will open with the guided setup wizard.\n");
|
|
43
|
+
}
|
|
35
44
|
await new Promise((resolve, reject) => {
|
|
36
45
|
server.once("error", reject);
|
|
37
46
|
server.listen(opts.port, opts.host, resolve);
|
|
@@ -44,6 +53,9 @@ export async function runStudioCli(argv) {
|
|
|
44
53
|
return 1;
|
|
45
54
|
const shownHost = opts.host === "0.0.0.0" ? firstPrivateAddress() ?? "127.0.0.1" : opts.host;
|
|
46
55
|
process.stdout.write(`AskDB Studio is running at http://${shownHost}:${address.port}\n`);
|
|
56
|
+
if (!isLoopbackHost(opts.host)) {
|
|
57
|
+
process.stderr.write(formatNetworkExposureWarning(opts.host));
|
|
58
|
+
}
|
|
47
59
|
process.stdout.write("Press Ctrl+C to stop.\n");
|
|
48
60
|
return await new Promise((resolve) => {
|
|
49
61
|
const stop = () => {
|
|
@@ -54,23 +66,32 @@ export async function runStudioCli(argv) {
|
|
|
54
66
|
});
|
|
55
67
|
}
|
|
56
68
|
function parseOptions(argv) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
69
|
+
// Without a config the runtime snapshot is uninitialized — fall back to
|
|
70
|
+
// package defaults so Studio can still start (in setup mode).
|
|
71
|
+
const rt = (() => {
|
|
72
|
+
try {
|
|
73
|
+
return getAskDbRuntimeConfig();
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
})();
|
|
79
|
+
const listen = rt?.structured.studio?.listen;
|
|
80
|
+
const introspectOut = rt?.flat["ASKDB_INTROSPECT_OUT"] ?? DEFAULT_INTROSPECT_OUTPUT_DIR;
|
|
63
81
|
const opts = {
|
|
64
82
|
schema: introspectOut,
|
|
65
|
-
|
|
66
|
-
|
|
83
|
+
schemaFromFlag: false,
|
|
84
|
+
host: listen?.host ?? "127.0.0.1",
|
|
85
|
+
port: 5556,
|
|
67
86
|
};
|
|
87
|
+
let portFromFlag = false;
|
|
68
88
|
for (let i = 0; i < argv.length; i += 1) {
|
|
69
89
|
const arg = argv[i];
|
|
70
90
|
switch (arg) {
|
|
71
91
|
case "--schema":
|
|
72
92
|
case "-s":
|
|
73
93
|
opts.schema = readValue(argv, ++i, arg);
|
|
94
|
+
opts.schemaFromFlag = true;
|
|
74
95
|
break;
|
|
75
96
|
case "--host":
|
|
76
97
|
opts.host = readValue(argv, ++i, arg);
|
|
@@ -82,6 +103,7 @@ function parseOptions(argv) {
|
|
|
82
103
|
throw new Error(`Invalid --port: ${raw}`);
|
|
83
104
|
}
|
|
84
105
|
opts.port = port;
|
|
106
|
+
portFromFlag = true;
|
|
85
107
|
break;
|
|
86
108
|
}
|
|
87
109
|
case "--help":
|
|
@@ -96,8 +118,30 @@ function parseOptions(argv) {
|
|
|
96
118
|
throw new Error(`Unknown option: ${arg}`);
|
|
97
119
|
}
|
|
98
120
|
}
|
|
121
|
+
// A bad configured port must fail, not quietly bind 5556. `NaN` (`Number(env("X"))` with X
|
|
122
|
+
// unset) counts as unset, as it does in @askdb/config; a numeric string works like a number.
|
|
123
|
+
const configPort = listen?.port;
|
|
124
|
+
if (!portFromFlag && !opts.help && !opts.version && configPort !== undefined && !Number.isNaN(configPort)) {
|
|
125
|
+
const port = Number(configPort);
|
|
126
|
+
if (!Number.isInteger(port) || port <= 0 || port > 65535) {
|
|
127
|
+
throw new Error(`Invalid studio.listen.port in askdb.config: ${String(configPort)} (expected an integer from 1 to 65535).`);
|
|
128
|
+
}
|
|
129
|
+
opts.port = port;
|
|
130
|
+
}
|
|
99
131
|
return opts;
|
|
100
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Decide whether to start in setup mode. An explicitly passed `--schema` that
|
|
135
|
+
* doesn't exist stays a hard error (the user pointed at a specific artifact);
|
|
136
|
+
* a missing config or a missing *default* artifact opens the wizard instead.
|
|
137
|
+
*/
|
|
138
|
+
function resolveSetupReason(opts) {
|
|
139
|
+
if (!discoverAskDbConfigPath(process.cwd()))
|
|
140
|
+
return "no-config";
|
|
141
|
+
if (!opts.schemaFromFlag && !existsSync(resolve(opts.schema)))
|
|
142
|
+
return "no-artifact";
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
101
145
|
function readValue(argv, index, flag) {
|
|
102
146
|
const value = argv[index];
|
|
103
147
|
if (!value || value.startsWith("--")) {
|
|
@@ -114,17 +158,30 @@ function printHelp(stream) {
|
|
|
114
158
|
"",
|
|
115
159
|
"Options:",
|
|
116
160
|
" -s, --schema <dir> Schema v2 directory (default: introspection.outputDir from",
|
|
117
|
-
" askdb.config, or
|
|
118
|
-
" --port <number> Port to listen on (default:
|
|
119
|
-
" --host <host> Host to bind (default: 127.0.0.1
|
|
161
|
+
" askdb.config, or ./askdb/)",
|
|
162
|
+
" --port <number> Port to listen on (default: studio.listen.port from askdb.config, or 5556)",
|
|
163
|
+
" --host <host> Host to bind (default: studio.listen.host from askdb.config, or 127.0.0.1)",
|
|
120
164
|
" -V, --version Print package version",
|
|
121
165
|
" -h, --help Print this help",
|
|
122
166
|
"",
|
|
123
|
-
"AI enrichment and sample NL-to-SQL use
|
|
124
|
-
"
|
|
167
|
+
"AI enrichment and sample NL-to-SQL use the ai block in askdb.config: ai.provider,",
|
|
168
|
+
"the key in ai.providerConfig.<provider>.apiKey, and the model in ai.language.model.",
|
|
169
|
+
"Bind any value to an environment variable with env(\"NAME\").",
|
|
125
170
|
"",
|
|
126
171
|
].join("\n"));
|
|
127
172
|
}
|
|
173
|
+
function formatNetworkExposureWarning(host) {
|
|
174
|
+
return [
|
|
175
|
+
"",
|
|
176
|
+
`WARNING: Studio is bound to ${host}, which other machines on your network can reach.`,
|
|
177
|
+
"Studio can execute SQL against your configured database and write schema files.",
|
|
178
|
+
"Anyone who can load the Studio page from this address gets its session token and",
|
|
179
|
+
"can use those features (setup, resync, and driver install stay loopback-only).",
|
|
180
|
+
"Only do this on a network you trust; the default 127.0.0.1 keeps Studio local.",
|
|
181
|
+
"",
|
|
182
|
+
"",
|
|
183
|
+
].join("\n");
|
|
184
|
+
}
|
|
128
185
|
function firstPrivateAddress() {
|
|
129
186
|
for (const entries of Object.values(networkInterfaces())) {
|
|
130
187
|
for (const entry of entries ?? []) {
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,kBAAkB,E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