@dbx-tools/appkit-mastra 0.3.22 → 0.3.23

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/package.json CHANGED
@@ -28,22 +28,22 @@
28
28
  "express": "^5.1.0",
29
29
  "pg": "^8.22.0",
30
30
  "zod": "^4.3.6",
31
- "@dbx-tools/appkit": "0.3.22",
32
- "@dbx-tools/databricks": "0.3.22",
33
- "@dbx-tools/genie": "0.3.22",
34
- "@dbx-tools/model": "0.3.22",
35
- "@dbx-tools/shared-core": "0.3.22",
36
- "@dbx-tools/shared-mastra": "0.3.22",
37
- "@dbx-tools/shared-genie": "0.3.22",
38
- "@dbx-tools/core": "0.3.22",
39
- "@dbx-tools/shared-model": "0.3.22"
31
+ "@dbx-tools/appkit": "0.3.23",
32
+ "@dbx-tools/genie": "0.3.23",
33
+ "@dbx-tools/databricks": "0.3.23",
34
+ "@dbx-tools/core": "0.3.23",
35
+ "@dbx-tools/model": "0.3.23",
36
+ "@dbx-tools/shared-core": "0.3.23",
37
+ "@dbx-tools/shared-mastra": "0.3.23",
38
+ "@dbx-tools/shared-genie": "0.3.23",
39
+ "@dbx-tools/shared-model": "0.3.23"
40
40
  },
41
41
  "main": "index.ts",
42
42
  "license": "UNLICENSED",
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
- "version": "0.3.22",
46
+ "version": "0.3.23",
47
47
  "types": "index.ts",
48
48
  "type": "module",
49
49
  "exports": {
package/src/agents.ts CHANGED
@@ -15,6 +15,9 @@
15
15
  * @module
16
16
  */
17
17
 
18
+ import { plugin } from "@dbx-tools/appkit";
19
+ import { fallback } from "@dbx-tools/model";
20
+ import { log, object, string } from "@dbx-tools/shared-core";
18
21
  import type { AgentConfig, ToolsInput } from "@mastra/core/agent";
19
22
  import { Agent } from "@mastra/core/agent";
20
23
  import type { Tool } from "@mastra/core/tools";
@@ -27,12 +30,9 @@ import type { MastraPluginConfig } from "./config";
27
30
  import { buildGenieToolkitProvider, resolveGenieSpaces } from "./genie";
28
31
  import type { MemoryBuilder } from "./memory";
29
32
  import { buildModel } from "./model";
30
- import { fallback } from "@dbx-tools/model";
31
33
  import { ResultProcessor, stripStaleChartsProcessor } from "./processors";
32
34
  import { buildSummarizeTool } from "./summarize";
33
35
  import { createWorkspace } from "./workspaces";
34
- import { log, object, string } from "@dbx-tools/shared-core";
35
- import { plugin } from "@dbx-tools/appkit";
36
36
 
37
37
  /**
38
38
  * Tool record accepted by every Mastra `Agent.tools` field and by the
package/src/chart.ts CHANGED
@@ -28,7 +28,9 @@
28
28
  */
29
29
 
30
30
  import { CacheManager } from "@databricks/appkit";
31
+ import { async, error, hash, log, string, type BrandContext } from "@dbx-tools/shared-core";
31
32
  import { wire, type Chart, type ChartResult } from "@dbx-tools/shared-mastra";
33
+ import { model } from "@dbx-tools/shared-model";
32
34
  import { Agent } from "@mastra/core/agent";
33
35
  import type { RequestContext } from "@mastra/core/request-context";
34
36
  import { createTool } from "@mastra/core/tools";
@@ -36,8 +38,6 @@ import { z } from "zod";
36
38
 
37
39
  import type { MastraPluginConfig } from "./config";
38
40
  import { buildModel } from "./model";
39
- import { model } from "@dbx-tools/shared-model";
40
- import { async, error, hash, log, string, type BrandContext } from "@dbx-tools/shared-core";
41
41
 
42
42
  const logger = log.logger("mastra/chart");
43
43
 
package/src/config.ts CHANGED
@@ -8,6 +8,7 @@
8
8
  */
9
9
 
10
10
  import type { BasePluginConfig } from "@databricks/appkit";
11
+ import { appkit } from "@dbx-tools/appkit";
11
12
  import type { BrandContext } from "@dbx-tools/shared-core";
12
13
  import type { AgentConfig } from "@mastra/core/agent";
13
14
  import { MASTRA_RESOURCE_ID_KEY, MASTRA_THREAD_ID_KEY } from "@mastra/core/request-context";
@@ -15,7 +16,6 @@ import type { PgVectorConfig, PostgresStoreConfig } from "@mastra/pg";
15
16
 
16
17
  import type { MastraAgentDefinition, MastraTools } from "./agents";
17
18
  import type { GenieSpacesConfig } from "./genie";
18
- import { appkit } from "@dbx-tools/appkit";
19
19
 
20
20
  /**
21
21
  * `RequestContext` key under which {@link MastraServer} stores the
@@ -13,8 +13,10 @@
13
13
  * @module
14
14
  */
15
15
 
16
+ import { posix as path } from "node:path";
16
17
  import { getExecutionContext } from "@databricks/appkit";
17
18
  import { WorkspaceClient } from "@databricks/sdk-experimental";
19
+ import { error, functionModule, hash, log } from "@dbx-tools/shared-core";
18
20
  import type {
19
21
  CopyOptions,
20
22
  FileContent,
@@ -26,8 +28,6 @@ import type {
26
28
  ReadOptions,
27
29
  RemoveOptions,
28
30
  WriteOptions,
29
- } from "@mastra/core/workspace";
30
- import {
31
31
  DirectoryNotEmptyError,
32
32
  DirectoryNotFoundError,
33
33
  FileExistsError,
@@ -39,8 +39,6 @@ import {
39
39
  WorkspaceReadOnlyError,
40
40
  type MastraFilesystemOptions,
41
41
  } from "@mastra/core/workspace";
42
- import { posix as path } from "node:path";
43
- import { error, functionModule, hash, log } from "@dbx-tools/shared-core";
44
42
 
45
43
  /* ------------------------------ constants ------------------------------ */
46
44
 
@@ -764,7 +762,7 @@ export class DatabricksWorkspaceFilesystem extends MastraFilesystem {
764
762
  const entries = await this.listAbsoluteDirectory(absolutePath);
765
763
  const filtered = this.filterEntries(entries, options);
766
764
  if (!options?.recursive) return filtered;
767
- return this.readDirectoryRecursive(absolutePath, options, 0);
765
+ return await this.readDirectoryRecursive(absolutePath, options, 0);
768
766
  } catch (err) {
769
767
  this.rethrow(err, inputPath);
770
768
  }
package/src/genie.ts CHANGED
@@ -38,11 +38,11 @@
38
38
 
39
39
  import { CacheManager, genie } from "@databricks/appkit";
40
40
  import { WorkspaceClient } from "@databricks/sdk-experimental";
41
- import { wire, type MastraWriter, type StartedEvent } from "@dbx-tools/shared-mastra";
41
+ import { plugin } from "@dbx-tools/appkit";
42
42
  import { chat, space as genieSpace } from "@dbx-tools/genie";
43
- import { genieModel, type GenieMessage } from "@dbx-tools/shared-genie";
44
43
  import { error, log, string } from "@dbx-tools/shared-core";
45
- import { plugin } from "@dbx-tools/appkit";
44
+ import { genieModel, type GenieMessage } from "@dbx-tools/shared-genie";
45
+ import { wire, type MastraWriter, type StartedEvent } from "@dbx-tools/shared-mastra";
46
46
  import type { RequestContext } from "@mastra/core/request-context";
47
47
  import { MASTRA_THREAD_ID_KEY } from "@mastra/core/request-context";
48
48
  import { createTool } from "@mastra/core/tools";
@@ -50,8 +50,7 @@ import { z } from "zod";
50
50
 
51
51
  import type { MastraTools } from "./agents";
52
52
  import { chartPlannerRequestSchema, prepareChart } from "./chart";
53
- import type { MastraPluginConfig } from "./config";
54
- import { MASTRA_USER_KEY, type User } from "./config";
53
+ import type { MastraPluginConfig, MASTRA_USER_KEY, type User } from "./config";
55
54
  import { fetchStatementData } from "./statement";
56
55
  import { safeWrite } from "./writer";
57
56
 
@@ -918,7 +917,7 @@ export function resolveGenieSpaces(
918
917
  const merged: Record<string, GenieSpaceConfig> = {};
919
918
 
920
919
  // Source 3 (lowest precedence): env var.
921
- const envSpaceId = process.env["DATABRICKS_GENIE_SPACE_ID"];
920
+ const envSpaceId = process.env.DATABRICKS_GENIE_SPACE_ID;
922
921
  if (envSpaceId) {
923
922
  merged[DEFAULT_GENIE_ALIAS] = { spaceId: envSpaceId };
924
923
  }
package/src/history.ts CHANGED
@@ -18,6 +18,7 @@
18
18
  * @module
19
19
  */
20
20
 
21
+ import { error, log } from "@dbx-tools/shared-core";
21
22
  import type {
22
23
  MastraClearHistoryResponse,
23
24
  MastraHistoryResponse,
@@ -31,7 +32,6 @@ import type { ContextWithMastra } from "@mastra/core/server";
31
32
  import { registerApiRoute } from "@mastra/core/server";
32
33
 
33
34
  import { clampPerPage, parseIntParam } from "./pagination";
34
- import { error, log } from "@dbx-tools/shared-core";
35
35
 
36
36
  const logger = log.logger("mastra/history");
37
37
 
package/src/memory.ts CHANGED
@@ -29,18 +29,18 @@
29
29
  * @module
30
30
  */
31
31
 
32
+ import { randomUUID } from "node:crypto";
32
33
  import { getUsernameWithApiLookup } from "@databricks/appkit";
34
+ import { log } from "@dbx-tools/shared-core";
33
35
  import { fastembed } from "@mastra/fastembed";
34
36
  import { Memory } from "@mastra/memory";
35
37
  import { PgVector, PostgresStore } from "@mastra/pg";
36
- import { randomUUID } from "node:crypto";
37
38
  import { Pool, type PoolConfig } from "pg";
38
39
 
39
40
  import type { MastraAgentDefinition, MastraMemoryConfigOverride } from "./agents";
40
41
  import type { MastraPluginConfig } from "./config";
41
42
  import { agentStorageSchemaName } from "./storage-schema";
42
43
  import { summaryModel, TITLE_INSTRUCTIONS } from "./summarize";
43
- import { log } from "@dbx-tools/shared-core";
44
44
 
45
45
  const logger = log.logger("mastra/memory");
46
46
 
package/src/mlflow.ts CHANGED
@@ -19,10 +19,10 @@
19
19
  * @module
20
20
  */
21
21
 
22
+ import { appkit } from "@dbx-tools/appkit";
23
+ import { async, error, log } from "@dbx-tools/shared-core";
22
24
  import { feedback } from "@dbx-tools/shared-mastra";
23
25
  import { databricksFetch, readResponseJson, readResponseText } from "./rest";
24
- import { async, error, log } from "@dbx-tools/shared-core";
25
- import { appkit } from "@dbx-tools/appkit";
26
26
 
27
27
  const logger = log.logger("mastra/mlflow");
28
28
 
package/src/model.ts CHANGED
@@ -25,14 +25,14 @@
25
25
 
26
26
  import { getExecutionContext } from "@databricks/appkit";
27
27
  import { classes, resolve } from "@dbx-tools/model";
28
+ import { functionModule, log, net } from "@dbx-tools/shared-core";
28
29
  import { model } from "@dbx-tools/shared-model";
29
30
  import type { MastraModelConfig } from "@mastra/core/llm";
30
31
  import type { RequestContext } from "@mastra/core/request-context";
31
32
 
32
33
  import { MASTRA_USER_KEY, type MastraPluginConfig, type User } from "./config";
33
- import { rewriteServingBody } from "./serving-sanitize";
34
34
  import { MASTRA_MODEL_OVERRIDE_KEY, resolveServingConfig } from "./serving";
35
- import { functionModule, log, net } from "@dbx-tools/shared-core";
35
+ import { rewriteServingBody } from "./serving-sanitize";
36
36
 
37
37
  type ModelClass = model.ModelClass;
38
38
  const { parseModelClass } = classes;
@@ -33,12 +33,12 @@
33
33
  * @module
34
34
  */
35
35
 
36
+ import { project } from "@dbx-tools/core";
37
+ import { log } from "@dbx-tools/shared-core";
36
38
  import { Observability } from "@mastra/observability";
37
39
  import { OtelBridge } from "@mastra/otel-bridge";
38
40
 
39
41
  import { TRACE_REQUEST_CONTEXT_KEYS } from "./config";
40
- import { log } from "@dbx-tools/shared-core";
41
- import { project } from "@dbx-tools/core";
42
42
 
43
43
  const logger = log.logger("mastra/observability");
44
44
 
package/src/serving.ts CHANGED
@@ -11,11 +11,11 @@
11
11
  * @module
12
12
  */
13
13
 
14
- import { override } from "@dbx-tools/shared-mastra";
15
14
  import { serving as nodeServing } from "@dbx-tools/model";
15
+ import { string } from "@dbx-tools/shared-core";
16
+ import { override } from "@dbx-tools/shared-mastra";
16
17
 
17
18
  import type { MastraPluginConfig } from "./config";
18
- import { string } from "@dbx-tools/shared-core";
19
19
 
20
20
  /**
21
21
  * `RequestContext` key under which {@link MastraServer} stores the
package/src/statement.ts CHANGED
@@ -20,8 +20,8 @@
20
20
  */
21
21
 
22
22
  import { WorkspaceClient } from "@databricks/sdk-experimental";
23
- import type { GenieDatasetData } from "@dbx-tools/shared-mastra";
24
23
  import { databricks } from "@dbx-tools/appkit";
24
+ import type { GenieDatasetData } from "@dbx-tools/shared-mastra";
25
25
 
26
26
  /**
27
27
  * Hard server-side cap on rows returned by the
package/src/summarize.ts CHANGED
@@ -19,6 +19,7 @@
19
19
  * @module
20
20
  */
21
21
 
22
+ import { string } from "@dbx-tools/shared-core";
22
23
  import { model } from "@dbx-tools/shared-model";
23
24
  import { Agent } from "@mastra/core/agent";
24
25
  import type { MastraModelConfig } from "@mastra/core/llm";
@@ -28,7 +29,6 @@ import { z } from "zod";
28
29
 
29
30
  import type { MastraPluginConfig } from "./config";
30
31
  import { buildModel } from "./model";
31
- import { string } from "@dbx-tools/shared-core";
32
32
 
33
33
  /** Fast / small chat tier used for both titling and summaries. */
34
34
  const SUMMARY_MODEL_CLASS = model.ModelClass.ChatFast;
package/src/threads.ts CHANGED
@@ -21,6 +21,7 @@
21
21
  * @module
22
22
  */
23
23
 
24
+ import { log } from "@dbx-tools/shared-core";
24
25
  import {
25
26
  wire,
26
27
  type MastraDeleteThreadResponse,
@@ -35,7 +36,6 @@ import type { ContextWithMastra } from "@mastra/core/server";
35
36
  import { registerApiRoute } from "@mastra/core/server";
36
37
 
37
38
  import { clampPerPage, parseIntParam } from "./pagination";
38
- import { log } from "@dbx-tools/shared-core";
39
39
 
40
40
  const logger = log.logger("mastra/threads");
41
41
 
package/src/workspaces.ts CHANGED
@@ -11,6 +11,7 @@
11
11
  */
12
12
 
13
13
  import type { WorkspaceClient } from "@databricks/sdk-experimental";
14
+ import { log, string, token } from "@dbx-tools/shared-core";
14
15
  import type { RequestContext } from "@mastra/core/request-context";
15
16
  import {
16
17
  CompositeFilesystem,
@@ -22,7 +23,6 @@ import {
22
23
 
23
24
  import { MASTRA_SCOPES_KEY, MASTRA_USER_EMAIL_KEY, MASTRA_USER_KEY, type User } from "./config";
24
25
  import { DatabricksWorkspaceFilesystem, emptyFilesystem } from "./filesystems";
25
- import { log, string, token } from "@dbx-tools/shared-core";
26
26
 
27
27
  /* ------------------------------ constants ------------------------------ */
28
28
 
package/src/writer.ts CHANGED
@@ -12,8 +12,8 @@
12
12
  * @module
13
13
  */
14
14
 
15
- import type { MastraWriter } from "@dbx-tools/shared-mastra";
16
15
  import { error, log } from "@dbx-tools/shared-core";
16
+ import type { MastraWriter } from "@dbx-tools/shared-mastra";
17
17
 
18
18
  /**
19
19
  * Best-effort `writer.write`. No-op when `writer` is undefined;
@@ -0,0 +1,14 @@
1
+ // ~~ Generated by projen. To modify, edit .projenrc.js and run "pnpm exec projen".
2
+ {
3
+ "extends": "../tsconfig.json",
4
+ "compilerOptions": {
5
+ "noEmit": true,
6
+ "rootDir": ".."
7
+ },
8
+ "include": [
9
+ "**/*.ts"
10
+ ],
11
+ "exclude": [
12
+ "node_modules"
13
+ ]
14
+ }