@dbx-tools/cli 0.9.154 → 0.9.157

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 (123) hide show
  1. package/bin/dbx-genie.ts +3 -2
  2. package/index.appkit.ts +9 -0
  3. package/index.auth.ts +9 -0
  4. package/index.brand.ts +18 -0
  5. package/index.genie-code.ts +18 -0
  6. package/index.graphiti.ts +7 -0
  7. package/index.lakebase-proxy.ts +18 -0
  8. package/index.model-gateway.ts +9 -0
  9. package/index.ts +5 -61
  10. package/index.tunnel.ts +14 -0
  11. package/lib/bin/dbx-genie.js +4 -3
  12. package/lib/index.appkit.d.ts +5 -0
  13. package/lib/index.appkit.js +8 -0
  14. package/lib/index.auth.d.ts +5 -0
  15. package/lib/index.auth.js +8 -0
  16. package/lib/index.brand.d.ts +14 -0
  17. package/lib/index.brand.js +14 -0
  18. package/lib/index.d.ts +5 -61
  19. package/lib/index.genie-code.d.ts +14 -0
  20. package/lib/index.genie-code.js +14 -0
  21. package/lib/index.graphiti.d.ts +3 -0
  22. package/lib/index.graphiti.js +6 -0
  23. package/lib/index.js +6 -43
  24. package/lib/index.lakebase-proxy.d.ts +14 -0
  25. package/lib/index.lakebase-proxy.js +14 -0
  26. package/lib/index.model-gateway.d.ts +5 -0
  27. package/lib/index.model-gateway.js +8 -0
  28. package/lib/index.tunnel.d.ts +10 -0
  29. package/lib/index.tunnel.js +12 -0
  30. package/lib/src/appkit/cli.d.ts +1 -2
  31. package/lib/src/appkit/cli.js +4 -5
  32. package/lib/src/auth/cli.d.ts +2 -2
  33. package/lib/src/auth/cli.js +2 -3
  34. package/lib/src/auth/options.d.ts +2 -2
  35. package/lib/src/auth/options.js +4 -6
  36. package/lib/src/bootstrap.js +10 -14
  37. package/lib/src/brand/options.js +2 -2
  38. package/lib/src/brand/run.js +6 -8
  39. package/lib/src/brand/showcase.js +5 -5
  40. package/lib/src/bun.js +6 -6
  41. package/lib/src/genie-code/cli.d.ts +2 -2
  42. package/lib/src/genie-code/cli.js +4 -4
  43. package/lib/src/genie-code/config.d.ts +1 -1
  44. package/lib/src/genie-code/config.js +7 -7
  45. package/lib/src/genie-code/install.d.ts +2 -2
  46. package/lib/src/genie-code/install.js +4 -4
  47. package/lib/src/genie-code/runner.d.ts +2 -3
  48. package/lib/src/genie-code/runner.js +13 -11
  49. package/lib/src/genie-code/runtime.d.ts +3 -3
  50. package/lib/src/genie-code/runtime.js +10 -9
  51. package/lib/src/graphiti/cli.d.ts +2 -3
  52. package/lib/src/graphiti/cli.js +7 -8
  53. package/lib/src/lakebase-proxy/cli.d.ts +1 -2
  54. package/lib/src/lakebase-proxy/cli.js +3 -4
  55. package/lib/src/lakebase-proxy/options.js +7 -9
  56. package/lib/src/lakebase-proxy/proxy.js +8 -8
  57. package/lib/src/model-gateway/cli.d.ts +2 -3
  58. package/lib/src/model-gateway/cli.js +3 -4
  59. package/lib/src/model-gateway/server.d.ts +1 -1
  60. package/lib/src/model-gateway/server.js +5 -6
  61. package/lib/src/root.js +3 -3
  62. package/lib/src/tunnel/app.js +7 -9
  63. package/lib/src/tunnel/cli.d.ts +1 -2
  64. package/lib/src/tunnel/cli.js +13 -14
  65. package/lib/src/tunnel/options.d.ts +5 -5
  66. package/lib/src/tunnel/options.js +11 -11
  67. package/lib/src/tunnel/proxy.js +18 -17
  68. package/lib/tsconfig.tsbuildinfo +1 -1
  69. package/package.json +58 -177
  70. package/src/appkit/cli.ts +2 -4
  71. package/src/auth/cli.ts +2 -4
  72. package/src/auth/options.ts +3 -5
  73. package/src/bootstrap.ts +9 -13
  74. package/src/brand/options.ts +1 -1
  75. package/src/brand/run.ts +7 -7
  76. package/src/brand/showcase.ts +4 -4
  77. package/src/bun.ts +6 -6
  78. package/src/genie-code/cli.ts +4 -4
  79. package/src/genie-code/config.ts +6 -6
  80. package/src/genie-code/install.ts +5 -7
  81. package/src/genie-code/runner.ts +12 -11
  82. package/src/genie-code/runtime.ts +10 -10
  83. package/src/graphiti/cli.ts +13 -9
  84. package/src/lakebase-proxy/cli.ts +7 -3
  85. package/src/lakebase-proxy/options.ts +13 -8
  86. package/src/lakebase-proxy/proxy.ts +7 -7
  87. package/src/model-gateway/cli.ts +7 -3
  88. package/src/model-gateway/server.ts +9 -5
  89. package/src/root.ts +2 -2
  90. package/src/tunnel/app.ts +6 -8
  91. package/src/tunnel/cli.ts +21 -15
  92. package/src/tunnel/options.ts +23 -15
  93. package/src/tunnel/proxy.ts +29 -20
  94. package/lib/src/appkit/index.d.ts +0 -5
  95. package/lib/src/appkit/index.js +0 -8
  96. package/lib/src/auth/index.d.ts +0 -5
  97. package/lib/src/auth/index.js +0 -8
  98. package/lib/src/brand/index.d.ts +0 -10
  99. package/lib/src/brand/index.js +0 -10
  100. package/lib/src/genie-code/index.d.ts +0 -12
  101. package/lib/src/genie-code/index.js +0 -12
  102. package/lib/src/genie-code/options.d.ts +0 -7
  103. package/lib/src/genie-code/options.js +0 -7
  104. package/lib/src/graphiti/index.d.ts +0 -5
  105. package/lib/src/graphiti/index.js +0 -7
  106. package/lib/src/graphiti/options.d.ts +0 -117
  107. package/lib/src/graphiti/options.js +0 -26
  108. package/lib/src/lakebase-proxy/index.d.ts +0 -13
  109. package/lib/src/lakebase-proxy/index.js +0 -13
  110. package/lib/src/model-gateway/index.d.ts +0 -3
  111. package/lib/src/model-gateway/index.js +0 -6
  112. package/lib/src/tunnel/index.d.ts +0 -8
  113. package/lib/src/tunnel/index.js +0 -10
  114. package/src/appkit/index.ts +0 -9
  115. package/src/auth/index.ts +0 -9
  116. package/src/brand/index.ts +0 -14
  117. package/src/genie-code/index.ts +0 -16
  118. package/src/genie-code/options.ts +0 -14
  119. package/src/graphiti/index.ts +0 -9
  120. package/src/graphiti/options.ts +0 -40
  121. package/src/lakebase-proxy/index.ts +0 -17
  122. package/src/model-gateway/index.ts +0 -7
  123. package/src/tunnel/index.ts +0 -12
package/src/brand/run.ts CHANGED
@@ -8,16 +8,16 @@ import { mkdtemp } from "node:fs/promises";
8
8
  import { tmpdir } from "node:os";
9
9
  import path from "node:path";
10
10
  import type { BrandResearch } from "@dbx-tools/appkit-generator";
11
- import { generateBrandPackage } from "@dbx-tools/appkit-generator/generate";
11
+ import { generateBrandPackage } from "@dbx-tools/appkit-generator";
12
12
  import {
13
13
  runWebAssetPageFetch,
14
14
  runWebFetch,
15
15
  runWebImageFetch,
16
- } from "@dbx-tools/appkit-web-search/fetch";
17
- import { createWebSearchRuntime } from "@dbx-tools/appkit-web-search/runtime";
18
- import { runWebSearch } from "@dbx-tools/appkit-web-search/search";
19
- import { createWorkspaceClient } from "@dbx-tools/databricks/workspace-client";
20
- import { object } from "@dbx-tools/shared-core";
16
+ createWebSearchRuntime,
17
+ runWebSearch,
18
+ } from "@dbx-tools/appkit-web-search";
19
+ import { createWorkspaceClient } from "@dbx-tools/databricks";
20
+ import { isRecord } from "@dbx-tools/shared-core";
21
21
  import type { BrandGenerationProgressEvent } from "@dbx-tools/shared-generator";
22
22
 
23
23
  import { writeBrandPackage, type WrittenBrandPackage } from "./export.ts";
@@ -64,7 +64,7 @@ export async function exportBrandFromPrompt(
64
64
  },
65
65
  signal,
66
66
  async (event) => {
67
- if (!object.isRecord(event)) return;
67
+ if (!isRecord(event)) return;
68
68
  const status = typeof event.status === "string" ? event.status : undefined;
69
69
  const eventMessage =
70
70
  typeof event.message === "string" ? event.message.trim() : undefined;
@@ -4,7 +4,7 @@
4
4
  * @module
5
5
  */
6
6
 
7
- import { stringUtils } from "@dbx-tools/shared-core";
7
+ import { escapeHtml, dedent } from "@dbx-tools/shared-core";
8
8
  import type { BrandPackage } from "@dbx-tools/shared-generator";
9
9
 
10
10
  function safeAsset(value: string | undefined): string | undefined {
@@ -22,13 +22,13 @@ function safeFontFamily(value: string): string {
22
22
  }
23
23
 
24
24
  function listItems(values: readonly string[]): string {
25
- return values.map((value) => `<li>${stringUtils.escapeHtml(value)}</li>`).join("");
25
+ return values.map((value) => `<li>${escapeHtml(value)}</li>`).join("");
26
26
  }
27
27
 
28
28
  /** Render one responsive brand presentation with desktop and mobile mockups. */
29
29
  export function renderBrandShowcase(brandPackage: BrandPackage): string {
30
30
  const { brand, visualReferences } = brandPackage;
31
- const html = stringUtils.escapeHtml;
31
+ const html = escapeHtml;
32
32
  const logo = safeAsset(brand.assets.logo.light) ?? safeAsset(brand.assets.icon.light);
33
33
  const icon = safeAsset(brand.assets.icon.light);
34
34
  const website = safeWebsite(brand.links.website);
@@ -75,7 +75,7 @@ export function renderBrandShowcase(brandPackage: BrandPackage): string {
75
75
  const headline = brand.tagline ?? brand.name;
76
76
 
77
77
  // prettier-ignore
78
- return stringUtils.dedent(
78
+ return dedent(
79
79
  // ============================================================================
80
80
  /*html*/`
81
81
  <!doctype html>
package/src/bun.ts CHANGED
@@ -22,8 +22,8 @@
22
22
  */
23
23
  import { existsSync } from "node:fs";
24
24
  import { delimiter, dirname, join } from "node:path";
25
- import { exec, projectUtils } from "@dbx-tools/core";
26
- import { functionUtils, log } from "@dbx-tools/shared-core";
25
+ import { spawnSync, npmRegistry } from "@dbx-tools/core";
26
+ import { log, memoize } from "@dbx-tools/shared-core";
27
27
  import { needsInstall } from "./root.ts";
28
28
 
29
29
  const logger = log.logger("dbx-tools:bun");
@@ -43,8 +43,8 @@ const REGISTRY_SUBCOMMANDS = new Set(["add", "install", "i", "update", "up"]);
43
43
  * container may export it without any `.npmrc` for lookup. Memoized: resolution
44
44
  * shells out.
45
45
  */
46
- const registryOverride = functionUtils.memoize((): string | undefined =>
47
- projectUtils.npmRegistry(null, { overrideOnly: true, envVars: true })?.toString(),
46
+ const registryOverride = memoize((): string | undefined =>
47
+ npmRegistry(null, { overrideOnly: true, envVars: true })?.toString(),
48
48
  );
49
49
 
50
50
  /** `--registry <url>` for a bun invocation, or `[]` when the subcommand doesn't resolve. */
@@ -98,7 +98,7 @@ function resolveBunArgvImpl(): string[] {
98
98
  }
99
99
 
100
100
  /** Memoized `[command, ...prefix]` argv prefix to run bun. */
101
- export const resolveBunArgv = functionUtils.memoize(resolveBunArgvImpl);
101
+ export const resolveBunArgv = memoize(resolveBunArgvImpl);
102
102
 
103
103
  /** Run bun with inherited stdio from `cwd`, forcing the resolved registry. */
104
104
  export function runBun(args: string[], cwd: string): void {
@@ -107,7 +107,7 @@ export function runBun(args: string[], cwd: string): void {
107
107
  if (registryArgs.length > 0) {
108
108
  logger.info(`running bun with registry: ${registryArgs[1]}`);
109
109
  }
110
- exec.spawnSync(command, [...prefix, ...args, ...registryArgs], {
110
+ spawnSync(command, [...prefix, ...args, ...registryArgs], {
111
111
  cwd,
112
112
  check: true,
113
113
  env: childEnv(),
@@ -5,9 +5,9 @@
5
5
  */
6
6
 
7
7
  import { addArgs, parseArgs } from "@dbx-tools/cli-args";
8
+ import { GenieCodeOptionsSchema, type GenieCodeOptions } from "@dbx-tools/shared-genie-code";
8
9
  import { Command } from "commander";
9
10
 
10
- import { GenieCodeCliOptionsSchema, type GenieCodeCliOptions } from "./options.ts";
11
11
  import { runGenieCode } from "./runtime.ts";
12
12
 
13
13
  /** Injectable managed Genie execution boundary for parser tests and embedding. */
@@ -15,7 +15,7 @@ export interface GenieCodeCliDependencies {
15
15
  run(input: {
16
16
  cwd: string;
17
17
  genieArgs: readonly string[];
18
- options: GenieCodeCliOptions;
18
+ options: GenieCodeOptions;
19
19
  }): Promise<void>;
20
20
  }
21
21
 
@@ -40,13 +40,13 @@ export function buildProgram(
40
40
  .passThroughOptions()
41
41
  .allowExcessArguments()
42
42
  .showHelpAfterError(),
43
- GenieCodeCliOptionsSchema,
43
+ GenieCodeOptionsSchema,
44
44
  );
45
45
  program.action(async (genieArgs: string[]) => {
46
46
  await dependencies.run({
47
47
  cwd: process.cwd(),
48
48
  genieArgs,
49
- options: parseArgs(program, GenieCodeCliOptionsSchema),
49
+ options: parseArgs(program, GenieCodeOptionsSchema),
50
50
  });
51
51
  });
52
52
  return program;
@@ -8,8 +8,8 @@ import { createHash, randomUUID } from "node:crypto";
8
8
  import { chmod, mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
9
9
  import { homedir } from "node:os";
10
10
  import { dirname, join, resolve } from "node:path";
11
- import { withFileLock } from "@dbx-tools/core/file-lock";
12
- import { object } from "@dbx-tools/shared-core";
11
+ import { withFileLock } from "@dbx-tools/core";
12
+ import { isRecord } from "@dbx-tools/shared-core";
13
13
  import {
14
14
  GenieCodeBaseConfigSchema,
15
15
  GenieCodeConfigSchema,
@@ -17,8 +17,8 @@ import {
17
17
  type GenieCodeBaseConfig,
18
18
  type GenieCodeConfig,
19
19
  type GenieCodeProviderOverlay,
20
- } from "@dbx-tools/shared-genie-code/config";
21
- import { genieCodeHomeName } from "@dbx-tools/shared-genie-code/options";
20
+ } from "@dbx-tools/shared-genie-code";
21
+ import { genieCodeHomeName } from "@dbx-tools/shared-genie-code";
22
22
  import { parse, stringify } from "smol-toml";
23
23
 
24
24
  /** Provider identifier written to the base and invocation overlay configurations. */
@@ -65,7 +65,7 @@ export function genieCodeBaseConfig(
65
65
  ): GenieCodeBaseConfig {
66
66
  const projects = Object.fromEntries(
67
67
  Object.entries(existingProjects).filter(
68
- ([, value]) => object.isRecord(value) && value.trust_level === "trusted",
68
+ ([, value]) => isRecord(value) && value.trust_level === "trusted",
69
69
  ),
70
70
  );
71
71
  return GenieCodeBaseConfigSchema.parse({
@@ -118,7 +118,7 @@ export function genieCodeConfig(options: WriteGenieCodeConfigOptions): GenieCode
118
118
  async function existingProjects(path: string): Promise<Record<string, unknown>> {
119
119
  try {
120
120
  const value = parse(await readFile(path, "utf8"));
121
- return object.isRecord(value.projects) ? value.projects : {};
121
+ return isRecord(value.projects) ? value.projects : {};
122
122
  } catch (error) {
123
123
  if (error instanceof Error && "code" in error && error.code === "ENOENT") return {};
124
124
  throw error;
@@ -6,8 +6,8 @@
6
6
 
7
7
  import { homedir } from "node:os";
8
8
  import { dirname, join } from "node:path";
9
- import { bin } from "@dbx-tools/core";
10
- import { GENIE_CODE_VERSION } from "@dbx-tools/shared-genie-code/options";
9
+ import { type BinContext, ensure } from "@dbx-tools/core";
10
+ import { GENIE_CODE_VERSION } from "@dbx-tools/shared-genie-code";
11
11
 
12
12
  interface GenieCodeAsset {
13
13
  target: string;
@@ -63,9 +63,7 @@ export function genieCodeAsset(
63
63
  }
64
64
 
65
65
  /** Install and return the shared Genie Code package entrypoint. */
66
- export async function installGenieCode(
67
- options: InstallGenieCodeOptions = {},
68
- ): Promise<bin.BinContext> {
66
+ export async function installGenieCode(options: InstallGenieCodeOptions = {}): Promise<BinContext> {
69
67
  const platform = options.platform ?? process.platform;
70
68
  const asset = genieCodeAsset(platform, options.architecture ?? process.arch);
71
69
  const executable = platform === "win32" ? "genie.exe" : "genie";
@@ -78,7 +76,7 @@ export async function installGenieCode(
78
76
  "releases",
79
77
  `${GENIE_CODE_VERSION}-${asset.target}`,
80
78
  );
81
- const destination: bin.BinContext = {
79
+ const destination: BinContext = {
82
80
  root,
83
81
  binDir: join(root, dirname(entrypoint)),
84
82
  path: join(root, entrypoint),
@@ -86,7 +84,7 @@ export async function installGenieCode(
86
84
  const url =
87
85
  `https://github.com/databricks/genie-code-cli/releases/download/v${GENIE_CODE_VERSION}/` +
88
86
  `genie-package-${asset.target}.tar.gz`;
89
- return bin.ensure(
87
+ return ensure(
90
88
  "genie",
91
89
  { url, sha256: asset.sha256 },
92
90
  {
@@ -4,18 +4,21 @@
4
4
  * @module
5
5
  */
6
6
 
7
- import { exec } from "@dbx-tools/core";
8
- import { asyncUtils, log } from "@dbx-tools/shared-core";
9
- import { GenieCodeRunnerOptionsSchema } from "@dbx-tools/shared-genie-code/options";
7
+ import { configUtils, spawn } from "@dbx-tools/core";
8
+ import { log, poll } from "@dbx-tools/shared-core";
9
+ import { GenieCodeRunnerOptionsSchema } from "@dbx-tools/shared-genie-code";
10
10
 
11
- /** Private environment field carrying serialized runner options. */
12
- const RUNNER_OPTIONS_ENV = "DBX_TOOLS_GENIE_RUNNER_OPTIONS";
11
+ /** Logical configuration key carrying serialized runner options. */
12
+ export const RUNNER_OPTIONS_KEY = "GENIE_RUNNER_OPTIONS";
13
13
  const logger = log.logger("genie-code:runner");
14
14
 
15
15
  /** Parse the serialized runner boundary from its private environment field. */
16
16
  export function genieCodeRunnerOptions(environment: NodeJS.ProcessEnv = process.env) {
17
- const serialized = environment[RUNNER_OPTIONS_ENV];
18
- if (!serialized) throw new Error(`${RUNNER_OPTIONS_ENV} is required`);
17
+ const serialized = configUtils.resolveValue(RUNNER_OPTIONS_KEY, {
18
+ data: environment,
19
+ sources: "config",
20
+ });
21
+ if (!serialized) throw new Error(`${configUtils.name(RUNNER_OPTIONS_KEY)} is required`);
19
22
  return GenieCodeRunnerOptionsSchema.parse(JSON.parse(serialized));
20
23
  }
21
24
 
@@ -25,7 +28,7 @@ export async function waitForGenieCodeGateway(
25
28
  bearerToken: string,
26
29
  timeoutMs: number,
27
30
  ): Promise<void> {
28
- for await (const ready of asyncUtils.poll(
31
+ for await (const ready of poll(
29
32
  async ({ signal }) => {
30
33
  try {
31
34
  const response = await fetch(healthUrl, {
@@ -65,7 +68,7 @@ export async function runGenieCodeChild(
65
68
  executable: options.executable,
66
69
  home: options.home,
67
70
  });
68
- const child = exec.spawn(options.executable, [...options.arguments], {
71
+ const child = spawn(options.executable, [...options.arguments], {
69
72
  cwd: process.cwd(),
70
73
  env: {
71
74
  ...environment,
@@ -80,5 +83,3 @@ export async function runGenieCodeChild(
80
83
  const result = await child;
81
84
  if (result.exitCode !== 0) process.exitCode = result.exitCode;
82
85
  }
83
-
84
- export { RUNNER_OPTIONS_ENV };
@@ -7,24 +7,24 @@
7
7
  import { randomBytes } from "node:crypto";
8
8
  import { rm } from "node:fs/promises";
9
9
  import { delimiter, dirname } from "node:path";
10
- import { DatabricksModelRegistry, models } from "@dbx-tools/appkit-model-gateway";
10
+ import { DatabricksModelRegistry, codexModelSlug } from "@dbx-tools/appkit-model-gateway";
11
11
  import * as auth from "@dbx-tools/auth";
12
- import { resolveServicePackageBin } from "@dbx-tools/cli-service/definition";
13
- import type { BinContext } from "@dbx-tools/core/bin";
14
- import { workspaceClient } from "@dbx-tools/databricks";
12
+ import { resolveServicePackageBin } from "@dbx-tools/cli-service";
13
+ import { configUtils, type BinContext } from "@dbx-tools/core";
14
+ import { createWorkspaceClient } from "@dbx-tools/databricks";
15
15
  import { log } from "@dbx-tools/shared-core";
16
16
  import {
17
17
  resolveGenieCodeOptions,
18
18
  type GenieCodeOptions,
19
19
  type GenieCodeRunnerOptions,
20
- } from "@dbx-tools/shared-genie-code/options";
21
- import type { ModelClass } from "@dbx-tools/shared-model/contracts";
20
+ } from "@dbx-tools/shared-genie-code";
21
+ import type { ModelClass } from "@dbx-tools/shared-model";
22
22
  import concurrently from "concurrently";
23
23
  import getPort from "get-port";
24
24
 
25
25
  import { writeGenieCodeConfig, type GenieCodeHome } from "./config.ts";
26
26
  import { installGenieCode } from "./install.ts";
27
- import { RUNNER_OPTIONS_ENV } from "./runner.ts";
27
+ import { RUNNER_OPTIONS_KEY } from "./runner.ts";
28
28
 
29
29
  const logger = log.logger("genie-code");
30
30
 
@@ -61,7 +61,7 @@ async function resolveCodexModel(
61
61
  profile: string,
62
62
  modelClass?: ModelClass,
63
63
  ): Promise<string> {
64
- const client = await workspaceClient.createWorkspaceClient({ profile });
64
+ const client = await createWorkspaceClient({ profile });
65
65
  const target = await new DatabricksModelRegistry({ client }).resolve(model, {
66
66
  requiresTools: true,
67
67
  ...(modelClass ? { modelClass } : {}),
@@ -72,7 +72,7 @@ async function resolveCodexModel(
72
72
  );
73
73
  }
74
74
  // Genie Code pins the exact system.ai service slug, which wins regardless of gateway preference.
75
- return models.codexModelSlug(target, true);
75
+ return codexModelSlug(target, true);
76
76
  }
77
77
 
78
78
  /** Inputs accepted by managed Genie Code preparation and execution. */
@@ -205,7 +205,7 @@ export async function runGenieCode(input: RunGenieCodeOptions = {}): Promise<voi
205
205
  ...process.env,
206
206
  PATH: path,
207
207
  DATABRICKS_CONFIG_PROFILE: prepared.profile,
208
- [RUNNER_OPTIONS_ENV]: JSON.stringify(runnerOptions),
208
+ [configUtils.name(RUNNER_OPTIONS_KEY)]: JSON.stringify(runnerOptions),
209
209
  },
210
210
  },
211
211
  ],
@@ -12,16 +12,20 @@ import { join } from "node:path";
12
12
 
13
13
  import { runtime as graphitiRuntime } from "@dbx-tools/appkit-memory/graphiti";
14
14
  import { addArgs, parseArgs, serializeArgs } from "@dbx-tools/cli-args";
15
- import { buildServiceCommand, type CliServiceCliDependencies } from "@dbx-tools/cli-service/cli";
16
- import { defineService, type CliServiceDefinition } from "@dbx-tools/cli-service/definition";
17
- import { serviceTrayIcon } from "@dbx-tools/cli-service/icon";
18
- import { Command } from "commander";
19
-
15
+ import {
16
+ buildServiceCommand,
17
+ type CliServiceCliDependencies,
18
+ defineService,
19
+ type CliServiceDefinition,
20
+ } from "@dbx-tools/cli-service";
21
+ import { serviceTrayIcon } from "@dbx-tools/cli-service";
20
22
  import {
21
23
  GraphitiCliOptionsSchema,
22
24
  GraphitiOptionsSchema,
23
25
  type GraphitiOptions,
24
- } from "./options.ts";
26
+ } from "@dbx-tools/shared-graphiti";
27
+ import { Command } from "commander";
28
+
25
29
  import { PACKAGE_VERSION } from "../../index.ts";
26
30
 
27
31
  const DEFAULT_SERVICE_DIRECTORY = join(homedir(), ".dbx-tools", "services", "graphiti");
@@ -74,18 +78,18 @@ export function buildProgram(
74
78
  .version(PACKAGE_VERSION, "-v, --version"),
75
79
  GraphitiCliOptionsSchema,
76
80
  ).action(async () => {
77
- await dependencies.run(graphitiOptions(program));
81
+ await dependencies.run(parseGraphitiOptions(program));
78
82
  });
79
83
 
80
84
  program.addCommand(
81
85
  buildServiceCommand(
82
- () => graphitiServiceDefinition(graphitiOptions(program)),
86
+ () => graphitiServiceDefinition(parseGraphitiOptions(program)),
83
87
  dependencies.service,
84
88
  ),
85
89
  );
86
90
  return program;
87
91
  }
88
92
 
89
- function graphitiOptions(command: Command): GraphitiOptions {
93
+ function parseGraphitiOptions(command: Command): GraphitiOptions {
90
94
  return GraphitiOptionsSchema.parse(parseArgs(command, GraphitiCliOptionsSchema));
91
95
  }
@@ -1,9 +1,13 @@
1
1
  /** Commander entry point for the pure Node Lakebase proxy. */
2
2
 
3
3
  import { addArgs, parseArgs, serializeArgs } from "@dbx-tools/cli-args";
4
- import { buildServiceCommand, type CliServiceCliDependencies } from "@dbx-tools/cli-service/cli";
5
- import { defineService, type CliServiceDefinition } from "@dbx-tools/cli-service/definition";
6
- import { serviceTrayIcon } from "@dbx-tools/cli-service/icon";
4
+ import {
5
+ buildServiceCommand,
6
+ type CliServiceCliDependencies,
7
+ defineService,
8
+ type CliServiceDefinition,
9
+ } from "@dbx-tools/cli-service";
10
+ import { serviceTrayIcon } from "@dbx-tools/cli-service";
7
11
  import { connectionUrl } from "@dbx-tools/lakebase";
8
12
  import { Command } from "commander";
9
13
 
@@ -4,24 +4,29 @@
4
4
  * @module
5
5
  */
6
6
 
7
- import { options } from "@dbx-tools/shared-core";
7
+ import {
8
+ PostgresConfigOptionsSchema,
9
+ listenAddressSchema,
10
+ DatabricksOptionsSchema,
11
+ LakebaseOptionsSchema,
12
+ } from "@dbx-tools/shared-core";
8
13
  import { z } from "zod";
9
14
 
10
15
  const text = (description: string) => z.string().trim().min(1).optional().describe(description);
11
16
 
12
17
  export const LakebaseProxyOptionsSchema = z
13
18
  .object({
14
- ...options.PostgresConfigOptionsSchema.shape,
15
- listen: options
16
- .listenAddressSchema({ port: 5432, loopback: true })
17
- .describe("Loopback listener address."),
19
+ ...PostgresConfigOptionsSchema.shape,
20
+ listen: listenAddressSchema({ port: 5432, loopback: true }).describe(
21
+ "Loopback listener address.",
22
+ ),
18
23
  startupTimeoutSeconds: z.coerce
19
24
  .number<number>()
20
25
  .int()
21
26
  .nonnegative()
22
27
  .default(30)
23
28
  .describe("Startup timeout in seconds."),
24
- profile: options.DatabricksOptionsSchema.shape.profile.describe("Exact Databricks profile."),
29
+ profile: DatabricksOptionsSchema.shape.profile.describe("Exact Databricks profile."),
25
30
  })
26
31
  .strict()
27
32
  .describe("Lakebase proxy listener and service options.");
@@ -29,8 +34,8 @@ export const LakebaseProxyOptionsSchema = z
29
34
  export const LakebaseProxyUrlOptionsSchema = z
30
35
  .object({
31
36
  target: text("Lakebase project, resource path, host, or URL."),
32
- lakebaseEndpoint: options.LakebaseOptionsSchema.shape.lakebaseEndpoint,
33
- listen: options.listenAddressSchema({ port: 5432 }).describe("Local proxy address."),
37
+ lakebaseEndpoint: LakebaseOptionsSchema.shape.lakebaseEndpoint,
38
+ listen: listenAddressSchema({ port: 5432 }).describe("Local proxy address."),
34
39
  })
35
40
  .strict()
36
41
  .refine(
@@ -4,7 +4,7 @@ import { createServer, type Server, type Socket } from "node:net";
4
4
  import type { Duplex } from "node:stream";
5
5
  import { LakebaseClient, requireAddress } from "@dbx-tools/lakebase";
6
6
  import { postgresConnectionOptions } from "@dbx-tools/postgres";
7
- import { errorUtils, log, stringUtils } from "@dbx-tools/shared-core";
7
+ import { log, toError, trimToUndefined } from "@dbx-tools/shared-core";
8
8
  import { Client } from "pg";
9
9
 
10
10
  import { CancellationRegistry } from "./cancellation.ts";
@@ -113,20 +113,20 @@ export class LakebaseProxy {
113
113
  try {
114
114
  target = requireAddress(targetText);
115
115
  } catch (error) {
116
- throw new ProxyFailure(message(error), "3D000", { cause: errorUtils.toError(error) });
116
+ throw new ProxyFailure(message(error), "3D000", { cause: toError(error) });
117
117
  }
118
- const startupUser = stringUtils.trimToUndefined(startup.parameters.user);
118
+ const startupUser = trimToUndefined(startup.parameters.user);
119
119
  let resolved;
120
120
  try {
121
121
  resolved = await this.client.resolve(target, startupUser);
122
122
  } catch (error) {
123
- throw new ProxyFailure(message(error), "3D000", { cause: errorUtils.toError(error) });
123
+ throw new ProxyFailure(message(error), "3D000", { cause: toError(error) });
124
124
  }
125
125
  let password;
126
126
  try {
127
127
  password = await this.client.generateDatabaseCredential(resolved.endpoint, startupUser);
128
128
  } catch (error) {
129
- throw new ProxyFailure(message(error), "28000", { cause: errorUtils.toError(error) });
129
+ throw new ProxyFailure(message(error), "28000", { cause: toError(error) });
130
130
  }
131
131
  let connected;
132
132
  try {
@@ -136,7 +136,7 @@ export class LakebaseProxy {
136
136
  postgresConnectionOptions(startup.parameters, this.options.postgresRole),
137
137
  );
138
138
  } catch (error) {
139
- throw new ProxyFailure(message(error), "08001", { cause: errorUtils.toError(error) });
139
+ throw new ProxyFailure(message(error), "08001", { cause: toError(error) });
140
140
  }
141
141
  upstream = connected.socket;
142
142
  cancellation = this.cancellations.register({
@@ -168,7 +168,7 @@ export class LakebaseProxy {
168
168
  ? error
169
169
  : error instanceof PostgresProtocolError
170
170
  ? new ProxyFailure(error.message, "08P01", { cause: error })
171
- : new ProxyFailure(message(error), "08001", { cause: errorUtils.toError(error) });
171
+ : new ProxyFailure(message(error), "08001", { cause: toError(error) });
172
172
  logger.warn("Lakebase connection failed", {
173
173
  durationMs: Date.now() - started,
174
174
  error: failure,
@@ -5,14 +5,18 @@
5
5
  */
6
6
 
7
7
  import { addArgs, parseArgs, serializeArgs } from "@dbx-tools/cli-args";
8
- import { buildServiceCommand, type CliServiceCliDependencies } from "@dbx-tools/cli-service/cli";
9
- import { defineService, type CliServiceDefinition } from "@dbx-tools/cli-service/definition";
8
+ import {
9
+ buildServiceCommand,
10
+ type CliServiceCliDependencies,
11
+ defineService,
12
+ type CliServiceDefinition,
13
+ } from "@dbx-tools/cli-service";
10
14
  import {
11
15
  ModelGatewayCliOptionsSchema,
12
16
  resolveModelGatewayCliOptions,
13
17
  type ModelGatewayCliOptions,
14
18
  type ModelGatewayOptions,
15
- } from "@dbx-tools/shared-model-gateway/options";
19
+ } from "@dbx-tools/shared-model-gateway";
16
20
  import { Command } from "commander";
17
21
 
18
22
  import { startModelGateway } from "./server.ts";
@@ -6,14 +6,18 @@
6
6
 
7
7
  import { createHash, timingSafeEqual } from "node:crypto";
8
8
  import { createApp, server } from "@databricks/appkit";
9
- import { ModelGateway } from "@dbx-tools/appkit-model-gateway";
10
- import { sendHealth, sendInference, sendModels } from "@dbx-tools/appkit-model-gateway/routes";
11
- import { workspaceClient } from "@dbx-tools/databricks";
9
+ import {
10
+ ModelGateway,
11
+ sendHealth,
12
+ sendInference,
13
+ sendModels,
14
+ } from "@dbx-tools/appkit-model-gateway";
15
+ import { createWorkspaceClient } from "@dbx-tools/databricks";
12
16
  import {
13
17
  resolveModelGatewayOptions,
14
18
  type ModelGatewayOptions,
15
19
  type ResolvedModelGatewayOptions,
16
- } from "@dbx-tools/shared-model-gateway/options";
20
+ } from "@dbx-tools/shared-model-gateway";
17
21
  import type express from "express";
18
22
 
19
23
  type AppKitServerOptions = NonNullable<Parameters<typeof server>[0]>;
@@ -65,7 +69,7 @@ export async function startModelGateway(options: ModelGatewayOptions = {}): Prom
65
69
  ...(resolved.modelClass ? { modelClass: resolved.modelClass } : {}),
66
70
  preferSystemModels: resolved.preferSystemModels,
67
71
  });
68
- const client = await workspaceClient.createWorkspaceClient({
72
+ const client = await createWorkspaceClient({
69
73
  ...(resolved.profile ? { profile: resolved.profile } : {}),
70
74
  });
71
75
  await createApp({
package/src/root.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  import { existsSync } from "node:fs";
7
7
  import { basename, join, resolve } from "node:path";
8
8
  import { projectUtils } from "@dbx-tools/core";
9
- import { functionUtils } from "@dbx-tools/shared-core";
9
+ import { memoize } from "@dbx-tools/shared-core";
10
10
 
11
11
  /**
12
12
  * Walk upward from `startDir` for `.projenrc.ts`. If none is found, try git
@@ -52,7 +52,7 @@ export function needsToolchain(root: string): boolean {
52
52
  }
53
53
 
54
54
  /** Async, memoized root lookup from the process cwd at first use. */
55
- export const workspaceRoot = functionUtils.memoize(() => findWorkspaceRoot());
55
+ export const workspaceRoot = memoize(() => findWorkspaceRoot());
56
56
 
57
57
  /** Short label for log output (`basename` of the resolved root). */
58
58
  export function rootLabel(root: string): string {
package/src/tunnel/app.ts CHANGED
@@ -16,11 +16,11 @@
16
16
  */
17
17
 
18
18
  import { lakebase, type WorkspaceClient } from "@databricks/appkit";
19
- import { appkit } from "@dbx-tools/appkit";
20
- import { authStorage } from "@dbx-tools/auth-gate";
19
+ import { createApp } from "@dbx-tools/appkit";
20
+ import { shouldUseLakebase } from "@dbx-tools/auth-gate";
21
21
  import { email } from "@dbx-tools/email";
22
22
  import { postgresConnectionOptions } from "@dbx-tools/postgres";
23
- import { object } from "@dbx-tools/shared-core";
23
+ import { isRecord } from "@dbx-tools/shared-core";
24
24
  import { authGate, type AuthGateApi, type AuthGateConfig } from "@dbx-tools/tunnel";
25
25
 
26
26
  /** Boot the gate app and return the handlers the proxy authenticates against. */
@@ -30,12 +30,10 @@ export async function startGateApp(
30
30
  ): Promise<AuthGateApi> {
31
31
  // No `server()` plugin: nothing here listens. `plugins` order matters - `email`
32
32
  // registers its transport before `authGate` looks for a sibling to send with.
33
- const plugins = await appkit.createApp({
33
+ const plugins = await createApp({
34
34
  client,
35
35
  plugins: [
36
- ...(authStorage.shouldUseLakebase(config)
37
- ? [lakebase({ pool: postgresConnectionOptions({}) })]
38
- : []),
36
+ ...(shouldUseLakebase(config) ? [lakebase({ pool: postgresConnectionOptions({}) })] : []),
39
37
  ...(config.sendCode ? [] : [email()]),
40
38
  authGate(config),
41
39
  ],
@@ -47,7 +45,7 @@ export async function startGateApp(
47
45
 
48
46
  function isAuthGateApi(value: unknown): value is AuthGateApi {
49
47
  return (
50
- object.isRecord(value) &&
48
+ isRecord(value) &&
51
49
  typeof value.basePath === "string" &&
52
50
  typeof value.passkeysEnabled === "boolean" &&
53
51
  typeof value.isProtectedHost === "function" &&