Skip to content

Commit 93ee540

Browse files
committed
fix(appkit): pkosiec's feedback
Signed-off-by: Hubert Zub <hubert.zub@databricks.com>
1 parent b2e1e2d commit 93ee540

13 files changed

Lines changed: 278 additions & 70 deletions

docs/docs/api/appkit/Class.DatabricksAdapter.md

Lines changed: 8 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/docs/api/appkit/Class.SupervisorApiAdapter.md

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/docs/api/appkit/Function.fromSupervisorApi.md

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/docs/api/appkit/Interface.SupervisorApiAdapterCtorOptions.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

docs/docs/api/appkit/Interface.SupervisorApiAdapterOptions.md

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/docs/api/appkit/Interface.WorkspaceClientLike.md

Lines changed: 66 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/docs/api/appkit/index.md

Lines changed: 54 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/docs/api/appkit/typedoc-sidebar.ts

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/appkit/src/agents/databricks.ts

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ import type {
55
AgentRunContext,
66
AgentToolDefinition,
77
} from "shared";
8-
import { stream as servingStream } from "../connectors/serving/client";
8+
import {
9+
type StreamBody,
10+
stream as servingStream,
11+
} from "../connectors/serving/client";
912
import { APPKIT_USER_AGENT, getClientOptions } from "../context/client-options";
1013

1114
/** Default cap for a single incomplete SSE line tail (DoS guard). */
@@ -101,17 +104,6 @@ function throwIfExceedsStreamLimit(
101104
}
102105
}
103106

104-
/**
105-
* Transport shim: given an OpenAI-compatible request body, returns the raw
106-
* SSE byte stream from the serving endpoint. Injected at construction time so
107-
* callers can swap in the workspace SDK (factory paths), a bare `fetch`
108-
* (the raw constructor), or a test fake.
109-
*/
110-
type StreamBody = (
111-
body: Record<string, unknown>,
112-
signal?: AbortSignal,
113-
) => Promise<ReadableStream<Uint8Array>>;
114-
115107
/**
116108
* Escape-hatch options: provide an `endpointUrl` + `authenticate()` and the
117109
* adapter uses a bare `fetch()` to call it. Useful for tests and for pointing
@@ -398,7 +390,7 @@ export class DatabricksAdapter implements AgentAdapter {
398390
if (!resolvedEndpoint) {
399391
throw new Error(
400392
"No endpoint name provided and DATABRICKS_SERVING_ENDPOINT_NAME env var is not set. " +
401-
"Pass an endpoint name or set DATABRICKS_SERVING_ENDPOINT_NAME.",
393+
"Pass an endpoint name or set DATABRICKS_SERVING_ENDPOINT_NAME.",
402394
);
403395
}
404396

@@ -425,11 +417,13 @@ export class DatabricksAdapter implements AgentAdapter {
425417
}
426418

427419
/**
428-
* Discoverability shim for the Supervisor API adapter. Returns a
429-
* {@link import("./supervisor-api").SupervisorApiAdapter}, NOT a
420+
* Discoverability shim for the Supervisor API adapter. Returns an
421+
* {@link AgentAdapter} (a `SupervisorApiAdapter` at runtime), NOT a
430422
* {@link DatabricksAdapter} — the two are separate classes (different
431-
* wire formats, different lifecycle). Surfaced here so application
432-
* developers see a single `DatabricksAdapter.from*` autocomplete root.
423+
* wire formats, different lifecycle). The return type is the
424+
* {@link AgentAdapter} interface so callers aren't bound to the concrete
425+
* class. Surfaced here so application developers see a single
426+
* `DatabricksAdapter.from*` autocomplete root.
433427
*
434428
* Dynamic-imports `./supervisor-api` to avoid forming a load-time cycle:
435429
* both files share `connectors/serving/client.ts`.
@@ -445,7 +439,7 @@ export class DatabricksAdapter implements AgentAdapter {
445439
*/
446440
static async fromSupervisorApi(
447441
options: import("./supervisor-api").SupervisorApiAdapterOptions,
448-
): Promise<import("./supervisor-api").SupervisorApiAdapter> {
442+
): Promise<AgentAdapter> {
449443
const { fromSupervisorApi } = await import("./supervisor-api");
450444
return fromSupervisorApi(options);
451445
}

0 commit comments

Comments
 (0)