@databricks/appkit 0.74.1 → 0.75.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.
Files changed (77) hide show
  1. package/CLAUDE.md +4 -1
  2. package/dist/appkit/package.js +1 -1
  3. package/dist/beta.d.ts +5 -5
  4. package/dist/beta.js +5 -4
  5. package/dist/cache/index.js +2 -2
  6. package/dist/cache/storage/persistent.js +1 -1
  7. package/dist/cli/commands/agent/eval.js +78 -6
  8. package/dist/cli/commands/agent/eval.js.map +1 -1
  9. package/dist/cli/commands/registry/add.js +1 -1
  10. package/dist/cli/commands/registry/config-writer.js +1 -1
  11. package/dist/cli/index.js +4 -1
  12. package/dist/cli/index.js.map +1 -1
  13. package/dist/connectors/index.js +1 -1
  14. package/dist/connectors/jobs/client.js +1 -1
  15. package/dist/connectors/lakebase/index.d.ts +2 -2
  16. package/dist/connectors/lakebase/index.d.ts.map +1 -1
  17. package/dist/connectors/lakebase/index.js +25 -2
  18. package/dist/connectors/lakebase/index.js.map +1 -1
  19. package/dist/connectors/mcp/client.js +1 -1
  20. package/dist/connectors/sql-warehouse/client.js +1 -1
  21. package/dist/context/service-context.js +1 -1
  22. package/dist/core/appkit.js +1 -1
  23. package/dist/database/errors.js +1 -1
  24. package/dist/evals/discover.d.ts +8 -1
  25. package/dist/evals/discover.d.ts.map +1 -1
  26. package/dist/evals/discover.js +11 -1
  27. package/dist/evals/discover.js.map +1 -1
  28. package/dist/evals/index.d.ts +3 -3
  29. package/dist/evals/index.js +2 -2
  30. package/dist/evals/run-evals.d.ts +9 -2
  31. package/dist/evals/run-evals.d.ts.map +1 -1
  32. package/dist/evals/run-evals.js +13 -2
  33. package/dist/evals/run-evals.js.map +1 -1
  34. package/dist/evals/types.d.ts +40 -2
  35. package/dist/evals/types.d.ts.map +1 -1
  36. package/dist/index.js +1 -1
  37. package/dist/plugin/dev-reader.js +1 -1
  38. package/dist/plugin/interceptors/retry.js +1 -1
  39. package/dist/plugin/plugin.js +1 -1
  40. package/dist/plugins/analytics/analytics.js +1 -1
  41. package/dist/plugins/analytics/result-delivery.js +1 -1
  42. package/dist/plugins/beta-exports.generated.d.ts +1 -3
  43. package/dist/plugins/beta-exports.generated.js +0 -2
  44. package/dist/plugins/database/config.js +14 -0
  45. package/dist/plugins/database/config.js.map +1 -0
  46. package/dist/plugins/database/database.d.ts +22 -5
  47. package/dist/plugins/database/database.d.ts.map +1 -1
  48. package/dist/plugins/database/database.js +23 -8
  49. package/dist/plugins/database/database.js.map +1 -1
  50. package/dist/plugins/database/lifecycle.js +3 -3
  51. package/dist/plugins/database/lifecycle.js.map +1 -1
  52. package/dist/plugins/database/load-schema.js +40 -0
  53. package/dist/plugins/database/load-schema.js.map +1 -0
  54. package/dist/plugins/database/manifest.js +1 -1
  55. package/dist/plugins/database/types.d.ts +12 -3
  56. package/dist/plugins/database/types.d.ts.map +1 -1
  57. package/dist/plugins/files/plugin.js +1 -1
  58. package/dist/plugins/jobs/plugin.js +1 -1
  59. package/dist/plugins/lakebase/lakebase.js +1 -1
  60. package/dist/plugins/server/index.js +1 -1
  61. package/dist/plugins/server/vite-dev-server.js +1 -1
  62. package/dist/registry/manifest-loader.d.ts +1 -1
  63. package/dist/registry/manifest-loader.js +1 -1
  64. package/dist/registry/resource-registry.js +1 -1
  65. package/dist/shared/src/schemas/manifest.d.ts +33 -33
  66. package/dist/stream/arrow-stream-processor.js +1 -1
  67. package/dist/stream/stream-manager.js +1 -1
  68. package/docs/api/appkit/Function.database.md +30 -29
  69. package/docs/api/appkit/Function.findRootEvalConfig.md +18 -0
  70. package/docs/api/appkit/Function.loadRootEvalConfig.md +18 -0
  71. package/docs/api/appkit/Interface.EvalWebServer.md +47 -0
  72. package/docs/api/appkit/TypeAlias.IDatabaseConfig.md +8 -6
  73. package/docs/api/appkit.md +4 -1
  74. package/docs/plugins/database.md +46 -18
  75. package/llms.txt +4 -1
  76. package/package.json +1 -1
  77. package/sbom.cdx.json +1 -1
@@ -63,6 +63,7 @@ Documentation merge entry for Typedoc — combines the stable `@databricks/appki
63
63
  | [EvalResult](./docs/api/appkit/Interface.EvalResult.md) | The outcome of running one eval. |
64
64
  | [EvalRunSummary](./docs/api/appkit/Interface.EvalRunSummary.md) | - |
65
65
  | [EvalSummary](./docs/api/appkit/Interface.EvalSummary.md) | - |
66
+ | [EvalWebServer](./docs/api/appkit/Interface.EvalWebServer.md) | Auto-start config for the app under test, à la Playwright's `webServer`. When set in a root `evals.config.ts`, the CLI boots the app before running evals and tears it down after — so you don't have to start the server by hand. |
66
67
  | [FilePolicyUser](./docs/api/appkit/Interface.FilePolicyUser.md) | Minimal user identity passed to the policy function. |
67
68
  | [FileResource](./docs/api/appkit/Interface.FileResource.md) | Describes the file or directory being acted upon. |
68
69
  | [FunctionTool](./docs/api/appkit/Interface.FunctionTool.md) | - |
@@ -197,7 +198,7 @@ Documentation merge entry for Typedoc — combines the stable `@databricks/appki
197
198
  | [createLakebasePool](./docs/api/appkit/Function.createLakebasePool.md) | Create a Lakebase pool with appkit's logger integration. Telemetry automatically uses appkit's OpenTelemetry configuration via global registry. |
198
199
  | [createLakebasePoolManager](./docs/api/appkit/Function.createLakebasePoolManager.md) | Create a pool manager that maintains per-key Lakebase connection pools. |
199
200
  | [createWorkspaceClient](./docs/api/appkit/Function.createWorkspaceClient.md) | Construct an AppKit workspace client. |
200
- | [database](./docs/api/appkit/Function.database.md) | Create a typed database plugin registration for a finalized schema. |
201
+ | [database](./docs/api/appkit/Function.database.md) | Create the database plugin. Omit configuration to load `config/database/schema.ts`, or supply a typed schema override. |
201
202
  | [defineEval](./docs/api/appkit/Function.defineEval.md) | Define an agent eval. Default-export the result from a `server/agents/<id>/evals/*.eval.ts` file. |
202
203
  | [defineEvalConfig](./docs/api/appkit/Function.defineEvalConfig.md) | Define per-directory eval config. Default-export from `evals.config.ts`. |
203
204
  | [defineManifest](./docs/api/appkit/Function.defineManifest.md) | Validates a raw manifest (typically a `manifest.json` import) against the canonical Zod schema and returns it as a strict [PluginManifest](./docs/api/appkit/Interface.PluginManifest.md). |
@@ -210,6 +211,7 @@ Documentation merge entry for Typedoc — combines the stable `@databricks/appki
210
211
  | [evalGlyph](./docs/api/appkit/Function.evalGlyph.md) | Status glyph for a single eval result. |
211
212
  | [executeFromRegistry](./docs/api/appkit/Function.executeFromRegistry.md) | Validates tool-call arguments against the entry's schema and invokes its handler. On validation failure, returns an LLM-friendly error string (matching the behavior of `tool()`) rather than throwing, so the model can self-correct on its next turn. |
212
213
  | [extractServingEndpoints](./docs/api/appkit/Function.extractServingEndpoints.md) | Extract serving endpoint config from a server file by AST-parsing it. Looks for `serving({ endpoints: { alias: { env: "..." }, ... } })` calls and extracts the endpoint alias names and their environment variable mappings. |
214
+ | [findRootEvalConfig](./docs/api/appkit/Function.findRootEvalConfig.md) | Path to the root `evals.config.ts` (from [defineEvalConfig](./docs/api/appkit/Function.defineEvalConfig.md)) at `<rootDir>/evals.config.ts`, or `undefined` when absent. The root config holds run-wide settings (`baseUrl`, `webServer`); it's distinct from the per-agent configs found by [discoverEvalConfigs](./docs/api/appkit/Function.discoverEvalConfigs.md). |
213
215
  | [findServerFile](./docs/api/appkit/Function.findServerFile.md) | Find the server entry file by checking candidate paths in order. |
214
216
  | [fk](./docs/api/appkit/Function.fk.md) | Declare foreign-key to another column. |
215
217
  | [formatEvalDetail](./docs/api/appkit/Function.formatEvalDetail.md) | Indented detail lines for a failing eval (error + failing assertions). |
@@ -240,6 +242,7 @@ Documentation merge entry for Typedoc — combines the stable `@databricks/appki
240
242
  | [jsonb](./docs/api/appkit/Function.jsonb.md) | - |
241
243
  | [loadAgentFromFile](./docs/api/appkit/Function.loadAgentFromFile.md) | Loads a single markdown agent file and resolves its frontmatter against registered plugin toolkits + ambient tool library. |
242
244
  | [loadAgentsFromDir](./docs/api/appkit/Function.loadAgentsFromDir.md) | Scans a directory for one subdirectory per agent, each containing `agent.md` (frontmatter + body). Produces an `AgentDefinition` record keyed by agent id (folder name). Throws on frontmatter errors or unresolved references. Returns an empty map if the directory does not exist. |
245
+ | [loadRootEvalConfig](./docs/api/appkit/Function.loadRootEvalConfig.md) | Load the root `evals.config.ts` under `rootDir` (the project root), or return `undefined` when there is none. This is the run-wide config carrying `baseUrl`/`webServer`; the CLI reads it to resolve options and manage the app-under-test lifecycle before calling [runEvalsInDir](./docs/api/appkit/Function.runEvalsInDir.md). |
243
246
  | [matches](./docs/api/appkit/Function.matches.md) | Passes when the value matches `pattern`. |
244
247
  | [mcpServer](./docs/api/appkit/Function.mcpServer.md) | Factory for declaring a custom MCP server tool. |
245
248
  | [normalizeHost](./docs/api/appkit/Function.normalizeHost.md) | Ensure the host has a scheme (Databricks env often lacks `https://`). |
@@ -4,7 +4,7 @@ Beta plugin
4
4
 
5
5
  This plugin is currently **beta**. APIs may change between minor releases. Import from `@databricks/appkit/beta`. See [Plugin Stability Tiers](./docs/plugins/stability.md).
6
6
 
7
- Declare a schema and use `database({ schema })` to get generated HTTP CRUD and a server-side database client. CRUD is enabled for every declared table by default. Use `api` to restrict the generated routes without disabling server-side access.
7
+ Declare your tables in `config/database/schema.ts` and register `database()` to get generated HTTP CRUD and a server-side database client. CRUD is enabled for every declared table by default. Use `api` to restrict the generated routes without disabling server-side access.
8
8
 
9
9
  Shared application access
10
10
 
@@ -16,19 +16,30 @@ Restrict access to the app and grant its service principal only the database per
16
16
 
17
17
  Configure a Lakebase `postgres` resource and its connection environment variables as described in [Lakebase configuration](./docs/plugins/lakebase.md#environment-variables). The database tables must already exist and match the declared schema. This plugin checks connectivity during setup; it does not create or migrate tables.
18
18
 
19
+ Apps scaffolded with the Database plugin selected include an empty `config/database/schema.ts`, so `database()` can start without requiring sample tables. Replace the empty declaration with your models when their PostgreSQL tables are ready.
20
+
21
+ For local development, the PostgreSQL username is resolved from your Databricks credentials when `PGUSER` and `DATABRICKS_CLIENT_ID` are absent. An explicitly configured username takes precedence.
22
+
19
23
  ```ts
20
- import { createApp, server } from "@databricks/appkit";
21
- import { database, defineSchema, id, text } from "@databricks/appkit/beta";
24
+ // config/database/schema.ts
25
+ import { defineSchema, id, text } from "@databricks/appkit/beta";
22
26
 
23
- const schema = defineSchema((builder) => ({
27
+ export const schema = defineSchema((builder) => ({
24
28
  notes: builder.table("notes", {
25
29
  id: id(),
26
30
  body: text().notNull(),
27
31
  }),
28
32
  }));
29
33
 
34
+ ```
35
+
36
+ ```ts
37
+ // server/index.ts
38
+ import { createApp, server } from "@databricks/appkit";
39
+ import { database } from "@databricks/appkit/beta";
40
+
30
41
  const AppKit = await createApp({
31
- plugins: [server(), database({ schema })],
42
+ plugins: [server(), database()],
32
43
  });
33
44
 
34
45
  ```
@@ -45,41 +56,59 @@ With the server plugin enabled, this registers:
45
56
 
46
57
  A table without a public primary key supports list and create only. `upsert` is available to server code but has no generated HTTP route.
47
58
 
59
+ ## Schema discovery and overrides[​](#schema-discovery-and-overrides "Direct link to Schema discovery and overrides")
60
+
61
+ `database()` and `database({})` use the same defaults. During setup, the plugin loads the named `schema` export from `config/database/schema.ts`, relative to the application's working directory. The file must export a finalized `defineSchema()` result. Missing files, import failures, and invalid exports fail setup before the plugin creates a connection pool; they do not silently create an empty schema.
62
+
63
+ Keep `config/database/schema.ts` and its local imports in your deployment. The plugin loads TypeScript through Jiti, so a plain Node production process does not need a separate TypeScript loader. The schema module should only declare tables, not connect to the database or start the app.
64
+
65
+ For a different layout or a deployment that contains only a server bundle, import the schema explicitly and pass it to the plugin:
66
+
67
+ ```ts
68
+ import { schema } from "../config/database/schema";
69
+
70
+ database({ schema });
71
+
72
+ ```
73
+
74
+ An explicit schema always takes precedence and skips file discovery. An invalid explicit schema fails setup instead of falling back to another file.
75
+
76
+ Run `appkit generate-types` to generate the database registry. With that registry, configuration without an explicit schema still infers table names and hook payloads. An explicitly supplied schema also checks configuration keys against its own table names.
77
+
48
78
  ## Restrict the generated API[​](#restrict-the-generated-api "Direct link to Restrict the generated API")
49
79
 
50
80
  Omitting `api`, or setting it to `true` or `{}`, enables full CRUD. Restrictions are optional. There is no separate write opt-in.
51
81
 
52
82
  ```ts
53
83
  // No generated HTTP routes. The server-side client still works.
54
- database({ schema, api: false });
84
+ database({ api: false });
55
85
 
56
86
  // Read-only routes for every table.
57
- database({ schema, api: { writes: false } });
87
+ database({ api: { writes: false } });
58
88
 
59
89
  // Full CRUD for selected tables only.
60
- database({ schema, api: { tables: ["notes"] } });
90
+ database({ api: { tables: ["notes"] } });
61
91
 
62
92
  // Allow reads, create, and update, but not delete.
63
93
  database({
64
- schema,
65
94
  api: { writes: { operations: ["create", "update"] } },
66
95
  });
67
96
 
68
97
  // Read every table, but allow writes only to notes.
69
98
  database({
70
- schema,
71
99
  api: { writes: { tables: ["notes"] } },
72
100
  });
73
101
 
74
102
  ```
75
103
 
76
- | Option | Default | Effect |
77
- | ----------------------- | ---------------------------- | ----------------------------------------- |
78
- | `api` | `true` | `false` disables all generated routes |
79
- | `api.tables` | All declared tables | Limits which tables have routes |
80
- | `api.writes` | `true` | `false` keeps only read routes |
81
- | `api.writes.tables` | All exposed tables | Limits which exposed tables accept writes |
82
- | `api.writes.operations` | `create`, `update`, `delete` | Limits which writes are enabled |
104
+ | Option | Default | Effect |
105
+ | ----------------------- | ------------------------------------------- | ----------------------------------------- |
106
+ | `schema` | Named export in `config/database/schema.ts` | Overrides automatic schema loading |
107
+ | `api` | `true` | `false` disables all generated routes |
108
+ | `api.tables` | All declared tables | Limits which tables have routes |
109
+ | `api.writes` | `true` | `false` keeps only read routes |
110
+ | `api.writes.tables` | All exposed tables | Limits which exposed tables accept writes |
111
+ | `api.writes.operations` | `create`, `update`, `delete` | Limits which writes are enabled |
83
112
 
84
113
  `api.tables: []` disables all generated routes. An empty write-table or write-operation list keeps reads and disables writes. Tables omitted from `api.tables` also cannot be included through relations on exposed tables. These restrictions apply to HTTP only, not to the server-side client or hooks.
85
114
 
@@ -114,7 +143,6 @@ A table can declare `beforeCreate`, `afterCreate`, `beforeUpdate`, `afterUpdate`
114
143
  import { DatabaseValidationError } from "@databricks/appkit";
115
144
 
116
145
  database({
117
- schema,
118
146
  hooks: {
119
147
  notes: {
120
148
  beforeCreate(values) {
package/llms.txt CHANGED
@@ -97,7 +97,7 @@ npx @databricks/appkit docs <query>
97
97
  - [Function: createLakebasePool()](./docs/api/appkit/Function.createLakebasePool.md): Create a Lakebase pool with appkit's logger integration.
98
98
  - [Function: createLakebasePoolManager()](./docs/api/appkit/Function.createLakebasePoolManager.md): Create a pool manager that maintains per-key Lakebase connection pools.
99
99
  - [Function: createWorkspaceClient()](./docs/api/appkit/Function.createWorkspaceClient.md): Construct an AppKit workspace client.
100
- - [Function: database()](./docs/api/appkit/Function.database.md): Create a typed database plugin registration for a finalized schema.
100
+ - [Function: database()](./docs/api/appkit/Function.database.md): Call Signature
101
101
  - [Function: defineEval()](./docs/api/appkit/Function.defineEval.md): Define an agent eval. Default-export the result from a
102
102
  - [Function: defineEvalConfig()](./docs/api/appkit/Function.defineEvalConfig.md): Define per-directory eval config. Default-export from evals.config.ts.
103
103
  - [Function: defineManifest()](./docs/api/appkit/Function.defineManifest.md): Validates a raw manifest (typically a manifest.json import) against the
@@ -110,6 +110,7 @@ npx @databricks/appkit docs <query>
110
110
  - [Function: evalGlyph()](./docs/api/appkit/Function.evalGlyph.md): Status glyph for a single eval result.
111
111
  - [Function: executeFromRegistry()](./docs/api/appkit/Function.executeFromRegistry.md): Validates tool-call arguments against the entry's schema and invokes its
112
112
  - [Function: extractServingEndpoints()](./docs/api/appkit/Function.extractServingEndpoints.md): Extract serving endpoint config from a server file by AST-parsing it.
113
+ - [Function: findRootEvalConfig()](./docs/api/appkit/Function.findRootEvalConfig.md): Path to the root evals.config.ts (from defineEvalConfig) at
113
114
  - [Function: findServerFile()](./docs/api/appkit/Function.findServerFile.md): Find the server entry file by checking candidate paths in order.
114
115
  - [Function: fk()](./docs/api/appkit/Function.fk.md): Declare foreign-key to another column.
115
116
  - [Function: formatEvalDetail()](./docs/api/appkit/Function.formatEvalDetail.md): Indented detail lines for a failing eval (error + failing assertions).
@@ -140,6 +141,7 @@ npx @databricks/appkit docs <query>
140
141
  - [Function: jsonb()](./docs/api/appkit/Function.jsonb.md): Returns
141
142
  - [Function: loadAgentFromFile()](./docs/api/appkit/Function.loadAgentFromFile.md): Loads a single markdown agent file and resolves its frontmatter against
142
143
  - [Function: loadAgentsFromDir()](./docs/api/appkit/Function.loadAgentsFromDir.md): Scans a directory for one subdirectory per agent, each containing
144
+ - [Function: loadRootEvalConfig()](./docs/api/appkit/Function.loadRootEvalConfig.md): Load the root evals.config.ts under rootDir (the project root), or return
143
145
  - [Function: matches()](./docs/api/appkit/Function.matches.md): Passes when the value matches pattern.
144
146
  - [Function: mcpServer()](./docs/api/appkit/Function.mcpServer.md): Factory for declaring a custom MCP server tool.
145
147
  - [Function: normalizeHost()](./docs/api/appkit/Function.normalizeHost.md): Ensure the host has a scheme (Databricks env often lacks https://).
@@ -189,6 +191,7 @@ npx @databricks/appkit docs <query>
189
191
  - [Interface: EvalResult](./docs/api/appkit/Interface.EvalResult.md): The outcome of running one eval.
190
192
  - [Interface: EvalRunSummary](./docs/api/appkit/Interface.EvalRunSummary.md): Properties
191
193
  - [Interface: EvalSummary](./docs/api/appkit/Interface.EvalSummary.md): Properties
194
+ - [Interface: EvalWebServer](./docs/api/appkit/Interface.EvalWebServer.md): Auto-start config for the app under test, à la Playwright's webServer. When
192
195
  - [Interface: FilePolicyUser](./docs/api/appkit/Interface.FilePolicyUser.md): Minimal user identity passed to the policy function.
193
196
  - [Interface: FileResource](./docs/api/appkit/Interface.FileResource.md): Describes the file or directory being acted upon.
194
197
  - [Interface: FunctionTool](./docs/api/appkit/Interface.FunctionTool.md): Properties
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@databricks/appkit",
3
3
  "type": "module",
4
- "version": "0.74.1",
4
+ "version": "0.75.1",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "bin": {