@databricks/appkit 0.30.1 → 0.32.0
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/CLAUDE.md +1 -0
- package/NOTICE.md +1 -0
- package/dist/appkit/package.js +1 -1
- package/dist/beta.d.ts +14 -1
- package/dist/beta.js +12 -1
- package/dist/connectors/index.js +3 -0
- package/dist/connectors/mcp/client.d.ts +60 -0
- package/dist/connectors/mcp/client.d.ts.map +1 -0
- package/dist/connectors/mcp/client.js +197 -0
- package/dist/connectors/mcp/client.js.map +1 -0
- package/dist/connectors/mcp/host-policy.d.ts +51 -0
- package/dist/connectors/mcp/host-policy.d.ts.map +1 -0
- package/dist/connectors/mcp/host-policy.js +168 -0
- package/dist/connectors/mcp/host-policy.js.map +1 -0
- package/dist/connectors/mcp/index.d.ts +3 -0
- package/dist/connectors/mcp/index.js +4 -0
- package/dist/connectors/mcp/types.d.ts +16 -0
- package/dist/connectors/mcp/types.d.ts.map +1 -0
- package/dist/context/index.js +1 -1
- package/dist/core/agent/build-toolkit.d.ts +2 -0
- package/dist/core/agent/build-toolkit.js +50 -0
- package/dist/core/agent/build-toolkit.js.map +1 -0
- package/dist/core/agent/consume-adapter-stream.js +33 -0
- package/dist/core/agent/consume-adapter-stream.js.map +1 -0
- package/dist/core/agent/create-agent.d.ts +27 -0
- package/dist/core/agent/create-agent.d.ts.map +1 -0
- package/dist/core/agent/create-agent.js +50 -0
- package/dist/core/agent/create-agent.js.map +1 -0
- package/dist/core/agent/load-agents.d.ts +67 -0
- package/dist/core/agent/load-agents.d.ts.map +1 -0
- package/dist/core/agent/load-agents.js +228 -0
- package/dist/core/agent/load-agents.js.map +1 -0
- package/dist/core/agent/normalize-result.js +39 -0
- package/dist/core/agent/normalize-result.js.map +1 -0
- package/dist/core/agent/run-agent.d.ts +34 -0
- package/dist/core/agent/run-agent.d.ts.map +1 -0
- package/dist/core/agent/run-agent.js +146 -0
- package/dist/core/agent/run-agent.js.map +1 -0
- package/dist/core/agent/system-prompt.js +38 -0
- package/dist/core/agent/system-prompt.js.map +1 -0
- package/dist/core/agent/tools/define-tool.d.ts +54 -0
- package/dist/core/agent/tools/define-tool.d.ts.map +1 -0
- package/dist/core/agent/tools/define-tool.js +50 -0
- package/dist/core/agent/tools/define-tool.js.map +1 -0
- package/dist/core/agent/tools/function-tool.d.ts +27 -0
- package/dist/core/agent/tools/function-tool.d.ts.map +1 -0
- package/dist/core/agent/tools/function-tool.js +21 -0
- package/dist/core/agent/tools/function-tool.js.map +1 -0
- package/dist/core/agent/tools/hosted-tools.d.ts +47 -0
- package/dist/core/agent/tools/hosted-tools.d.ts.map +1 -0
- package/dist/core/agent/tools/hosted-tools.js +67 -0
- package/dist/core/agent/tools/hosted-tools.js.map +1 -0
- package/dist/core/agent/tools/index.d.ts +5 -0
- package/dist/core/agent/tools/index.js +7 -0
- package/dist/core/agent/tools/json-schema.js +24 -0
- package/dist/core/agent/tools/json-schema.js.map +1 -0
- package/dist/core/agent/tools/sql-policy.js +256 -0
- package/dist/core/agent/tools/sql-policy.js.map +1 -0
- package/dist/core/agent/tools/tool.d.ts +34 -0
- package/dist/core/agent/tools/tool.d.ts.map +1 -0
- package/dist/core/agent/tools/tool.js +41 -0
- package/dist/core/agent/tools/tool.js.map +1 -0
- package/dist/core/agent/types.d.ts +214 -0
- package/dist/core/agent/types.d.ts.map +1 -0
- package/dist/core/agent/types.js +12 -0
- package/dist/core/agent/types.js.map +1 -0
- package/dist/core/appkit.d.ts +1 -0
- package/dist/core/appkit.d.ts.map +1 -1
- package/dist/core/appkit.js +31 -4
- package/dist/core/appkit.js.map +1 -1
- package/dist/core/plugin-context.d.ts +133 -0
- package/dist/core/plugin-context.d.ts.map +1 -0
- package/dist/core/plugin-context.js +220 -0
- package/dist/core/plugin-context.js.map +1 -0
- package/dist/index.d.ts +11 -11
- package/dist/internal-telemetry/appkit-log.js +19 -0
- package/dist/internal-telemetry/appkit-log.js.map +1 -0
- package/dist/internal-telemetry/config.js +15 -0
- package/dist/internal-telemetry/config.js.map +1 -0
- package/dist/internal-telemetry/index.js +4 -0
- package/dist/internal-telemetry/reporter.js +132 -0
- package/dist/internal-telemetry/reporter.js.map +1 -0
- package/dist/plugin/index.d.ts +1 -1
- package/dist/plugin/plugin.d.ts +18 -3
- package/dist/plugin/plugin.d.ts.map +1 -1
- package/dist/plugin/plugin.js +26 -2
- package/dist/plugin/plugin.js.map +1 -1
- package/dist/plugin/to-plugin.d.ts +15 -4
- package/dist/plugin/to-plugin.d.ts.map +1 -1
- package/dist/plugin/to-plugin.js +14 -4
- package/dist/plugin/to-plugin.js.map +1 -1
- package/dist/plugins/agents/agents.d.ts +4 -0
- package/dist/plugins/agents/agents.js +882 -0
- package/dist/plugins/agents/agents.js.map +1 -0
- package/dist/plugins/agents/defaults.js +13 -0
- package/dist/plugins/agents/defaults.js.map +1 -0
- package/dist/plugins/agents/event-channel.js +64 -0
- package/dist/plugins/agents/event-channel.js.map +1 -0
- package/dist/plugins/agents/event-translator.js +224 -0
- package/dist/plugins/agents/event-translator.js.map +1 -0
- package/dist/plugins/agents/index.d.ts +4 -0
- package/dist/plugins/agents/index.js +6 -0
- package/dist/plugins/agents/manifest.js +27 -0
- package/dist/plugins/agents/manifest.js.map +1 -0
- package/dist/plugins/agents/schemas.js +51 -0
- package/dist/plugins/agents/schemas.js.map +1 -0
- package/dist/plugins/agents/thread-store.js +58 -0
- package/dist/plugins/agents/thread-store.js.map +1 -0
- package/dist/plugins/agents/tool-approval-gate.js +75 -0
- package/dist/plugins/agents/tool-approval-gate.js.map +1 -0
- package/dist/plugins/analytics/analytics.d.ts +17 -2
- package/dist/plugins/analytics/analytics.d.ts.map +1 -1
- package/dist/plugins/analytics/analytics.js +33 -0
- package/dist/plugins/analytics/analytics.js.map +1 -1
- package/dist/plugins/files/plugin.d.ts +22 -3
- package/dist/plugins/files/plugin.d.ts.map +1 -1
- package/dist/plugins/files/plugin.js +102 -2
- package/dist/plugins/files/plugin.js.map +1 -1
- package/dist/plugins/genie/genie.d.ts +15 -2
- package/dist/plugins/genie/genie.d.ts.map +1 -1
- package/dist/plugins/genie/genie.js +45 -0
- package/dist/plugins/genie/genie.js.map +1 -1
- package/dist/plugins/jobs/plugin.d.ts +2 -1
- package/dist/plugins/jobs/plugin.d.ts.map +1 -1
- package/dist/plugins/jobs/plugin.js +1 -1
- package/dist/plugins/lakebase/index.d.ts +2 -2
- package/dist/plugins/lakebase/index.js +1 -1
- package/dist/plugins/lakebase/lakebase.d.ts +33 -4
- package/dist/plugins/lakebase/lakebase.d.ts.map +1 -1
- package/dist/plugins/lakebase/lakebase.js +77 -5
- package/dist/plugins/lakebase/lakebase.js.map +1 -1
- package/dist/plugins/lakebase/types.d.ts +38 -1
- package/dist/plugins/lakebase/types.d.ts.map +1 -1
- package/dist/plugins/server/index.d.ts +20 -1
- package/dist/plugins/server/index.d.ts.map +1 -1
- package/dist/plugins/server/index.js +66 -7
- package/dist/plugins/server/index.js.map +1 -1
- package/dist/plugins/server/types.d.ts +0 -3
- package/dist/plugins/server/types.d.ts.map +1 -1
- package/dist/plugins/serving/serving.d.ts +2 -1
- package/dist/plugins/serving/serving.d.ts.map +1 -1
- package/dist/registry/manifest-loader.d.ts +2 -2
- package/dist/registry/manifest-loader.d.ts.map +1 -1
- package/dist/shared/src/agent.d.ts +63 -1
- package/dist/shared/src/agent.d.ts.map +1 -1
- package/dist/shared/src/index.d.ts +1 -1
- package/dist/shared/src/plugin.d.ts +8 -0
- package/dist/shared/src/plugin.d.ts.map +1 -1
- package/docs/api/appkit/Class.Plugin.md +65 -23
- package/docs/api/appkit/Function.createApp.md +10 -8
- package/docs/privacy.md +41 -0
- package/llms.txt +1 -0
- package/package.json +5 -2
- package/sbom.cdx.json +1 -1
|
@@ -1,8 +1,39 @@
|
|
|
1
1
|
import { JSONSchema7 } from "json-schema";
|
|
2
2
|
|
|
3
3
|
//#region ../shared/src/agent.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Semantic hint for what the tool does to the world. Drives both the
|
|
6
|
+
* agents-plugin approval gate and the client's approval-card styling.
|
|
7
|
+
*
|
|
8
|
+
* - `read` — observes only; never needs approval.
|
|
9
|
+
* - `write` — creates or appends new state (e.g. saving a new view). Approval
|
|
10
|
+
* required by default. Rendered as a low-severity "writes" card.
|
|
11
|
+
* - `update` — mutates existing state in place (e.g. renaming, toggling).
|
|
12
|
+
* Approval required. Rendered as a medium-severity "updates" card.
|
|
13
|
+
* - `destructive` — deletes or irreversibly mutates (e.g. dropping a view).
|
|
14
|
+
* Approval required. Rendered as a high-severity "destructive" card.
|
|
15
|
+
*
|
|
16
|
+
* Prefer this over the legacy `readOnly`/`destructive` booleans: it lets the
|
|
17
|
+
* UI distinguish "captured a screenshot" from "deleted a dashboard", both of
|
|
18
|
+
* which today are lumped under a single red "destructive" label.
|
|
19
|
+
*/
|
|
20
|
+
type ToolEffect = "read" | "write" | "update" | "destructive";
|
|
4
21
|
interface ToolAnnotations {
|
|
22
|
+
/**
|
|
23
|
+
* Preferred semantic label. When set, drives both the approval gate (fires
|
|
24
|
+
* for `write`/`update`/`destructive`) and the approval-card styling.
|
|
25
|
+
*/
|
|
26
|
+
effect?: ToolEffect;
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated Prefer {@link effect}. Retained for backward compatibility
|
|
29
|
+
* with tools authored against the original flags and for MCP interop.
|
|
30
|
+
*/
|
|
5
31
|
readOnly?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Prefer {@link effect} with value `"destructive"`. Retained
|
|
34
|
+
* so existing annotations continue to force the approval gate, and so
|
|
35
|
+
* MCP-style consumers that only read `destructive` still see the hint.
|
|
36
|
+
*/
|
|
6
37
|
destructive?: boolean;
|
|
7
38
|
idempotent?: boolean;
|
|
8
39
|
requiresUserContext?: boolean;
|
|
@@ -13,6 +44,10 @@ interface AgentToolDefinition {
|
|
|
13
44
|
parameters: JSONSchema7;
|
|
14
45
|
annotations?: ToolAnnotations;
|
|
15
46
|
}
|
|
47
|
+
interface ToolProvider {
|
|
48
|
+
getAgentTools(): AgentToolDefinition[];
|
|
49
|
+
executeAgentTool(name: string, args: unknown, signal?: AbortSignal): Promise<unknown>;
|
|
50
|
+
}
|
|
16
51
|
interface Message {
|
|
17
52
|
id: string;
|
|
18
53
|
role: "user" | "assistant" | "system" | "tool";
|
|
@@ -26,6 +61,20 @@ interface ToolCall {
|
|
|
26
61
|
name: string;
|
|
27
62
|
args: unknown;
|
|
28
63
|
}
|
|
64
|
+
interface Thread {
|
|
65
|
+
id: string;
|
|
66
|
+
userId: string;
|
|
67
|
+
messages: Message[];
|
|
68
|
+
createdAt: Date;
|
|
69
|
+
updatedAt: Date;
|
|
70
|
+
}
|
|
71
|
+
interface ThreadStore {
|
|
72
|
+
create(userId: string): Promise<Thread>;
|
|
73
|
+
get(threadId: string, userId: string): Promise<Thread | null>;
|
|
74
|
+
list(userId: string): Promise<Thread[]>;
|
|
75
|
+
addMessage(threadId: string, userId: string, message: Message): Promise<void>;
|
|
76
|
+
delete(threadId: string, userId: string): Promise<boolean>;
|
|
77
|
+
}
|
|
29
78
|
type AgentEvent = {
|
|
30
79
|
type: "message_delta";
|
|
31
80
|
content: string;
|
|
@@ -52,6 +101,19 @@ type AgentEvent = {
|
|
|
52
101
|
} | {
|
|
53
102
|
type: "metadata";
|
|
54
103
|
data: Record<string, unknown>;
|
|
104
|
+
} | {
|
|
105
|
+
/**
|
|
106
|
+
* Emitted by the agents plugin (not adapters) when a tool call annotated
|
|
107
|
+
* `destructive: true` is awaiting human approval. Clients should render
|
|
108
|
+
* an approval prompt and POST to `/chat/approve` with the matching
|
|
109
|
+
* `approvalId` and a `decision` of `approve` or `deny`.
|
|
110
|
+
*/
|
|
111
|
+
type: "approval_pending";
|
|
112
|
+
approvalId: string;
|
|
113
|
+
streamId: string;
|
|
114
|
+
toolName: string;
|
|
115
|
+
args: unknown;
|
|
116
|
+
annotations?: ToolAnnotations;
|
|
55
117
|
};
|
|
56
118
|
interface AgentInput {
|
|
57
119
|
messages: Message[];
|
|
@@ -68,5 +130,5 @@ interface AgentAdapter {
|
|
|
68
130
|
run(input: AgentInput, context: AgentRunContext): AsyncGenerator<AgentEvent, void, unknown>;
|
|
69
131
|
}
|
|
70
132
|
//#endregion
|
|
71
|
-
export { AgentAdapter, AgentEvent, AgentInput, AgentRunContext, AgentToolDefinition, Message, ToolAnnotations, ToolCall };
|
|
133
|
+
export { AgentAdapter, AgentEvent, AgentInput, AgentRunContext, AgentToolDefinition, Message, Thread, ThreadStore, ToolAnnotations, ToolCall, ToolEffect, ToolProvider };
|
|
72
134
|
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","names":[],"sources":["../../../../shared/src/agent.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"agent.d.ts","names":[],"sources":["../../../../shared/src/agent.ts"],"mappings":";;;;;AAsBA;;;;;AAEA;;;;;;;;;KAFY,UAAA;AAAA,UAEK,eAAA;EAkBI;AAGrB;;;EAhBE,MAAA,GAAS,UAAA;EAiBT;;;;EAZA,QAAA;EAec;;;AAGhB;;EAZE,WAAA;EACA,UAAA;EACA,mBAAA;AAAA;AAAA,UAGe,mBAAA;EACf,IAAA;EACA,WAAA;EACA,UAAA,EAAY,WAAA;EACZ,WAAA,GAAc,eAAA;AAAA;AAAA,UAGC,YAAA;EACf,aAAA,IAAiB,mBAAA;EACjB,gBAAA,CACE,IAAA,UACA,IAAA,WACA,MAAA,GAAS,WAAA,GACR,OAAA;AAAA;AAAA,UAOY,OAAA;EACf,EAAA;EACA,IAAA;EACA,OAAA;EACA,UAAA;EACA,SAAA,GAAY,QAAA;EACZ,SAAA,EAAW,IAAA;AAAA;AAAA,UAGI,QAAA;EACf,EAAA;EACA,IAAA;EACA,IAAA;AAAA;AAAA,UAGe,MAAA;EACf,EAAA;EACA,MAAA;EACA,QAAA,EAAU,OAAA;EACV,SAAA,EAAW,IAAA;EACX,SAAA,EAAW,IAAA;AAAA;AAAA,UAOI,WAAA;EACf,MAAA,CAAO,MAAA,WAAiB,OAAA,CAAQ,MAAA;EAChC,GAAA,CAAI,QAAA,UAAkB,MAAA,WAAiB,OAAA,CAAQ,MAAA;EAC/C,IAAA,CAAK,MAAA,WAAiB,OAAA,CAAQ,MAAA;EAC9B,UAAA,CAAW,QAAA,UAAkB,MAAA,UAAgB,OAAA,EAAS,OAAA,GAAU,OAAA;EAChE,MAAA,CAAO,QAAA,UAAkB,MAAA,WAAiB,OAAA;AAAA;AAAA,KAOhC,UAAA;EACN,IAAA;EAAuB,OAAA;AAAA;EACvB,IAAA;EAAiB,OAAA;AAAA;EACjB,IAAA;EAAmB,MAAA;EAAgB,IAAA;EAAc,IAAA;AAAA;EAEjD,IAAA;EACA,MAAA;EACA,MAAA;EACA,KAAA;AAAA;EAEA,IAAA;EAAkB,OAAA;AAAA;EAElB,IAAA;EACA,MAAA;EACA,KAAA;AAAA;EAEA,IAAA;EAAkB,IAAA,EAAM,MAAA;AAAA;EAvBc;;;;;;EA+BtC,IAAA;EACA,UAAA;EACA,QAAA;EACA,QAAA;EACA,IAAA;EACA,WAAA,GAAc,eAAA;AAAA;AAAA,UA6HH,UAAA;EACf,QAAA,EAAU,OAAA;EACV,KAAA,EAAO,mBAAA;EACP,QAAA;EACA,MAAA,GAAS,WAAA;AAAA;AAAA,UAGM,eAAA;EAUa;EAR5B,WAAA,GAAc,IAAA,UAAc,IAAA,cAAkB,OAAA;EAC9C,MAAA,GAAS,WAAA;AAAA;AAAA,UAGM,YAAA;EACf,GAAA,CACE,KAAA,EAAO,UAAA,EACP,OAAA,EAAS,eAAA,GACR,cAAA,CAAe,UAAA;AAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AgentAdapter, AgentEvent, AgentInput, AgentRunContext, AgentToolDefinition, Message, ToolAnnotations, ToolCall } from "./agent.js";
|
|
1
|
+
import { AgentAdapter, AgentEvent, AgentInput, AgentRunContext, AgentToolDefinition, Message, Thread, ThreadStore, ToolAnnotations, ToolCall, ToolEffect, ToolProvider } from "./agent.js";
|
|
2
2
|
import { ResourceFieldEntry } from "./schemas/plugin-manifest.generated.js";
|
|
3
3
|
import { BasePlugin, BasePluginConfig, HttpMethod, IAppRequest, IAppResponse, IAppRouter, PluginConstructor, PluginData, PluginEndpointMap, PluginExports, PluginManifest, PluginMap, PluginPhase, ResourceRequirement, RouteConfig, TelemetryOptions, ToPlugin, WithAsUser } from "./plugin.js";
|
|
4
4
|
import { CacheConfig, CacheEntry, CacheStorage } from "./cache.js";
|
|
@@ -13,6 +13,14 @@ interface BasePlugin {
|
|
|
13
13
|
getSkipBodyParsingPaths?(): ReadonlySet<string>;
|
|
14
14
|
exports?(): unknown;
|
|
15
15
|
clientConfig?(): Record<string, unknown>;
|
|
16
|
+
/**
|
|
17
|
+
* Binds runtime dependencies (telemetry, cache, plugin context) after the
|
|
18
|
+
* plugin has been constructed. Called by the AppKit core before `setup()`.
|
|
19
|
+
*/
|
|
20
|
+
attachContext?(deps: {
|
|
21
|
+
context?: unknown;
|
|
22
|
+
telemetryConfig?: TelemetryOptions;
|
|
23
|
+
}): void;
|
|
16
24
|
}
|
|
17
25
|
/** Base configuration interface for AppKit plugins */
|
|
18
26
|
interface BasePluginConfig {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","names":[],"sources":["../../../../shared/src/plugin.ts"],"mappings":";;;;;;UAYiB,UAAA;EACf,IAAA;EAEA,qBAAA;EAEA,KAAA,IAAS,OAAA;EAET,YAAA,CAAa,MAAA,EAAQ,OAAA,CAAQ,MAAA;EAE7B,YAAA,IAAgB,iBAAA;EAEhB,uBAAA,KAA4B,WAAA;EAE5B,OAAA;EAEA,YAAA,KAAiB,MAAA;AAAA;;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","names":[],"sources":["../../../../shared/src/plugin.ts"],"mappings":";;;;;;UAYiB,UAAA;EACf,IAAA;EAEA,qBAAA;EAEA,KAAA,IAAS,OAAA;EAET,YAAA,CAAa,MAAA,EAAQ,OAAA,CAAQ,MAAA;EAE7B,YAAA,IAAgB,iBAAA;EAEhB,uBAAA,KAA4B,WAAA;EAE5B,OAAA;EAEA,YAAA,KAAiB,MAAA;EAQmB;;;;EAFpC,aAAA,EAAe,IAAA;IACb,OAAA;IACA,eAAA,GAAkB,gBAAA;EAAA;AAAA;;UAKL,gBAAA;EACf,IAAA;EACA,IAAA;EAAA,CAEC,GAAA;EAMD,SAAA,GAAY,gBAAA;AAAA;AAAA,KAGF,gBAAA;EAGN,MAAA;EACA,OAAA;EACA,IAAA;AAAA;AAAA,KAQM,WAAA;;;;;KAMA,iBAAA,KACN,gBAAA,YACM,UAAA,GAAa,UAAA,UAEvB,MAAA,EAAQ,CAAA,KACL,CAAA;EACH,cAAA,GAAiB,MAAA;EACjB,KAAA,GAAQ,WAAA;EA7BoB;;AAG9B;;EA+BE,QAAA,EAAU,cAAA;EA/BgB;;;;EAoC1B,uBAAA,EAAyB,MAAA,EAAQ,CAAA,GAAI,mBAAA;AAAA;AAvBvC;;;;;AAMA;;;;AANA,UAmCiB,cAAA,wCACP,IAAA,CACN,gBAAA;EAGF,IAAA,EAAM,KAAA;EACN,SAAA;IACE,QAAA,EAAU,IAAA,CAAK,mBAAA;IACf,QAAA,EAAU,IAAA,CAAK,mBAAA;EAAA;EAEjB,MAAA;IACE,MAAA,EAAQ,WAAA;EAAA;AAAA;;;;;;;;;UAYK,mBAAA,SAA4B,qBAAA;EAC3C,MAAA,EAAQ,MAAA,SAAe,kBAAA;EACvB,QAAA;AAAA;;;;;;KAoCU,aAAA,WAAwB,UAAA,IAClC,CAAA,sCAAqC,CAAA,GAAI,MAAA;;;;;;;;KAS/B,UAAA,QAAkB,GAAA,cAAgB,IAAA,mBAC1C,GAAA,GACA,GAAA;EAjEA;;;;;EAuEE,MAAA,GAAS,GAAA,EAAK,WAAA,KAAgB,GAAA;AAAA;;AAxDpC;;;;;;;KAmEY,SAAA,oBACS,UAAA,CAAW,iBAAA,gCAExB,CAAA,YAAa,CAAA,WAAY,UAAA,CAC7B,aAAA,CAAc,YAAA,CAAa,CAAA;;KAKnB,UAAA;EAAwB,MAAA,EAAQ,CAAA;EAAG,MAAA,EAAQ,CAAA;EAAG,IAAA,EAAM,CAAA;AAAA;;KAEpD,QAAA,4BACV,MAAA,GAAS,CAAA,KACN,UAAA,CAAW,CAAA,EAAG,CAAA,EAAG,CAAA;;KAGV,UAAA,GAAa,OAAA,CAAQ,MAAA;AAAA,KACrB,YAAA,GAAe,OAAA,CAAQ,QAAA;AAAA,KACvB,WAAA,GAAc,OAAA,CAAQ,OAAA;AAAA,KAEtB,UAAA;AAAA,KAEA,WAAA;EAnDwB,+DAqDlC,IAAA;EACA,MAAA,EAAQ,UAAA;EACR,IAAA;EACA,OAAA,GAAU,GAAA,EAAK,WAAA,EAAa,GAAA,EAAK,YAAA,KAAiB,OAAA,QAvDH;EAyD/C,eAAA;AAAA;;KAIU,iBAAA,GAAoB,MAAA"}
|
|
@@ -139,6 +139,15 @@ protected config: TConfig;
|
|
|
139
139
|
|
|
140
140
|
***
|
|
141
141
|
|
|
142
|
+
### context?[](#context "Direct link to context?")
|
|
143
|
+
|
|
144
|
+
```ts
|
|
145
|
+
protected optional context: PluginContext;
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
***
|
|
150
|
+
|
|
142
151
|
### devFileReader[](#devfilereader "Direct link to devFileReader")
|
|
143
152
|
|
|
144
153
|
```ts
|
|
@@ -255,6 +264,39 @@ AuthenticationError if user token is not available in request headers (productio
|
|
|
255
264
|
|
|
256
265
|
***
|
|
257
266
|
|
|
267
|
+
### attachContext()[](#attachcontext "Direct link to attachContext()")
|
|
268
|
+
|
|
269
|
+
```ts
|
|
270
|
+
attachContext(deps: {
|
|
271
|
+
context?: unknown;
|
|
272
|
+
telemetryConfig?: TelemetryOptions;
|
|
273
|
+
}): void;
|
|
274
|
+
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
Binds runtime dependencies (telemetry provider, cache, plugin context) to this plugin. Called by `AppKit._createApp` after construction and before `setup()`. Idempotent: safe to call if the constructor already bound them eagerly. Kept separate so factories can eagerly construct plugin instances without running this before `TelemetryManager.initialize()` / `CacheManager.getInstance()` have run.
|
|
278
|
+
|
|
279
|
+
#### Parameters[](#parameters-2 "Direct link to Parameters")
|
|
280
|
+
|
|
281
|
+
| Parameter | Type |
|
|
282
|
+
| ----------------------- | ------------------------------------------------------------------ |
|
|
283
|
+
| `deps` | { `context?`: `unknown`; `telemetryConfig?`: `TelemetryOptions`; } |
|
|
284
|
+
| `deps.context?` | `unknown` |
|
|
285
|
+
| `deps.telemetryConfig?` | `TelemetryOptions` |
|
|
286
|
+
|
|
287
|
+
#### Returns[](#returns-3 "Direct link to Returns")
|
|
288
|
+
|
|
289
|
+
`void`
|
|
290
|
+
|
|
291
|
+
#### Implementation of[](#implementation-of-2 "Direct link to Implementation of")
|
|
292
|
+
|
|
293
|
+
```ts
|
|
294
|
+
BasePlugin.attachContext
|
|
295
|
+
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
***
|
|
299
|
+
|
|
258
300
|
### clientConfig()[](#clientconfig "Direct link to clientConfig()")
|
|
259
301
|
|
|
260
302
|
```ts
|
|
@@ -272,7 +314,7 @@ Values must be JSON-serializable plain data (no functions, Dates, classes, Maps,
|
|
|
272
314
|
|
|
273
315
|
On the client, read the config with the `usePluginClientConfig` hook (React) or the `getPluginClientConfig` function (vanilla JS), both from `@databricks/appkit-ui`.
|
|
274
316
|
|
|
275
|
-
#### Returns[](#returns-
|
|
317
|
+
#### Returns[](#returns-4 "Direct link to Returns")
|
|
276
318
|
|
|
277
319
|
`Record`<`string`, `unknown`>
|
|
278
320
|
|
|
@@ -304,7 +346,7 @@ const config = getPluginClientConfig<MyPluginConfig>("myPlugin");
|
|
|
304
346
|
|
|
305
347
|
```
|
|
306
348
|
|
|
307
|
-
#### Implementation of[](#implementation-of-
|
|
349
|
+
#### Implementation of[](#implementation-of-3 "Direct link to Implementation of")
|
|
308
350
|
|
|
309
351
|
```ts
|
|
310
352
|
BasePlugin.clientConfig
|
|
@@ -338,7 +380,7 @@ Errors are never thrown — the method is production-safe.
|
|
|
338
380
|
| -------------- |
|
|
339
381
|
| `T` |
|
|
340
382
|
|
|
341
|
-
#### Parameters[](#parameters-
|
|
383
|
+
#### Parameters[](#parameters-3 "Direct link to Parameters")
|
|
342
384
|
|
|
343
385
|
| Parameter | Type |
|
|
344
386
|
| ---------- | -------------------------------------------- |
|
|
@@ -346,7 +388,7 @@ Errors are never thrown — the method is production-safe.
|
|
|
346
388
|
| `options` | `PluginExecutionSettings` |
|
|
347
389
|
| `userKey?` | `string` |
|
|
348
390
|
|
|
349
|
-
#### Returns[](#returns-
|
|
391
|
+
#### Returns[](#returns-5 "Direct link to Returns")
|
|
350
392
|
|
|
351
393
|
`Promise`<[`ExecutionResult`](./docs/api/appkit/TypeAlias.ExecutionResult.md)<`T`>>
|
|
352
394
|
|
|
@@ -369,7 +411,7 @@ userKey?: string): Promise<void>;
|
|
|
369
411
|
| -------------- |
|
|
370
412
|
| `T` |
|
|
371
413
|
|
|
372
|
-
#### Parameters[](#parameters-
|
|
414
|
+
#### Parameters[](#parameters-4 "Direct link to Parameters")
|
|
373
415
|
|
|
374
416
|
| Parameter | Type |
|
|
375
417
|
| ---------- | ----------------------------------------------------------------------------------------- |
|
|
@@ -378,7 +420,7 @@ userKey?: string): Promise<void>;
|
|
|
378
420
|
| `options` | [`StreamExecutionSettings`](./docs/api/appkit/Interface.StreamExecutionSettings.md) |
|
|
379
421
|
| `userKey?` | `string` |
|
|
380
422
|
|
|
381
|
-
#### Returns[](#returns-
|
|
423
|
+
#### Returns[](#returns-6 "Direct link to Returns")
|
|
382
424
|
|
|
383
425
|
`Promise`<`void`>
|
|
384
426
|
|
|
@@ -395,7 +437,7 @@ Returns the public exports for this plugin. Override this to define a custom pub
|
|
|
395
437
|
|
|
396
438
|
The returned object becomes the plugin's public API on the AppKit instance (e.g. `appkit.myPlugin.method()`). AppKit automatically binds method context and adds `asUser(req)` for user-scoped execution.
|
|
397
439
|
|
|
398
|
-
#### Returns[](#returns-
|
|
440
|
+
#### Returns[](#returns-7 "Direct link to Returns")
|
|
399
441
|
|
|
400
442
|
`unknown`
|
|
401
443
|
|
|
@@ -416,7 +458,7 @@ appkit.myPlugin.getData();
|
|
|
416
458
|
|
|
417
459
|
```
|
|
418
460
|
|
|
419
|
-
#### Implementation of[](#implementation-of-
|
|
461
|
+
#### Implementation of[](#implementation-of-4 "Direct link to Implementation of")
|
|
420
462
|
|
|
421
463
|
```ts
|
|
422
464
|
BasePlugin.exports
|
|
@@ -432,11 +474,11 @@ getEndpoints(): PluginEndpointMap;
|
|
|
432
474
|
|
|
433
475
|
```
|
|
434
476
|
|
|
435
|
-
#### Returns[](#returns-
|
|
477
|
+
#### Returns[](#returns-8 "Direct link to Returns")
|
|
436
478
|
|
|
437
479
|
`PluginEndpointMap`
|
|
438
480
|
|
|
439
|
-
#### Implementation of[](#implementation-of-
|
|
481
|
+
#### Implementation of[](#implementation-of-5 "Direct link to Implementation of")
|
|
440
482
|
|
|
441
483
|
```ts
|
|
442
484
|
BasePlugin.getEndpoints
|
|
@@ -452,11 +494,11 @@ getSkipBodyParsingPaths(): ReadonlySet<string>;
|
|
|
452
494
|
|
|
453
495
|
```
|
|
454
496
|
|
|
455
|
-
#### Returns[](#returns-
|
|
497
|
+
#### Returns[](#returns-9 "Direct link to Returns")
|
|
456
498
|
|
|
457
499
|
`ReadonlySet`<`string`>
|
|
458
500
|
|
|
459
|
-
#### Implementation of[](#implementation-of-
|
|
501
|
+
#### Implementation of[](#implementation-of-6 "Direct link to Implementation of")
|
|
460
502
|
|
|
461
503
|
```ts
|
|
462
504
|
BasePlugin.getSkipBodyParsingPaths
|
|
@@ -472,17 +514,17 @@ injectRoutes(_: Router): void;
|
|
|
472
514
|
|
|
473
515
|
```
|
|
474
516
|
|
|
475
|
-
#### Parameters[](#parameters-
|
|
517
|
+
#### Parameters[](#parameters-5 "Direct link to Parameters")
|
|
476
518
|
|
|
477
519
|
| Parameter | Type |
|
|
478
520
|
| --------- | -------- |
|
|
479
521
|
| `_` | `Router` |
|
|
480
522
|
|
|
481
|
-
#### Returns[](#returns-
|
|
523
|
+
#### Returns[](#returns-10 "Direct link to Returns")
|
|
482
524
|
|
|
483
525
|
`void`
|
|
484
526
|
|
|
485
|
-
#### Implementation of[](#implementation-of-
|
|
527
|
+
#### Implementation of[](#implementation-of-7 "Direct link to Implementation of")
|
|
486
528
|
|
|
487
529
|
```ts
|
|
488
530
|
BasePlugin.injectRoutes
|
|
@@ -498,14 +540,14 @@ protected registerEndpoint(name: string, path: string): void;
|
|
|
498
540
|
|
|
499
541
|
```
|
|
500
542
|
|
|
501
|
-
#### Parameters[](#parameters-
|
|
543
|
+
#### Parameters[](#parameters-6 "Direct link to Parameters")
|
|
502
544
|
|
|
503
545
|
| Parameter | Type |
|
|
504
546
|
| --------- | -------- |
|
|
505
547
|
| `name` | `string` |
|
|
506
548
|
| `path` | `string` |
|
|
507
549
|
|
|
508
|
-
#### Returns[](#returns-
|
|
550
|
+
#### Returns[](#returns-11 "Direct link to Returns")
|
|
509
551
|
|
|
510
552
|
`void`
|
|
511
553
|
|
|
@@ -522,13 +564,13 @@ Resolve the effective user ID from a request.
|
|
|
522
564
|
|
|
523
565
|
Returns the `x-forwarded-user` header when present. In development mode (`NODE_ENV=development`) falls back to the current context user ID so that callers outside an active `runInUserContext` scope still get a consistent value.
|
|
524
566
|
|
|
525
|
-
#### Parameters[](#parameters-
|
|
567
|
+
#### Parameters[](#parameters-7 "Direct link to Parameters")
|
|
526
568
|
|
|
527
569
|
| Parameter | Type |
|
|
528
570
|
| --------- | --------- |
|
|
529
571
|
| `req` | `Request` |
|
|
530
572
|
|
|
531
|
-
#### Returns[](#returns-
|
|
573
|
+
#### Returns[](#returns-12 "Direct link to Returns")
|
|
532
574
|
|
|
533
575
|
`string`
|
|
534
576
|
|
|
@@ -551,14 +593,14 @@ protected route<_TResponse>(router: Router, config: RouteConfig): void;
|
|
|
551
593
|
| -------------- |
|
|
552
594
|
| `_TResponse` |
|
|
553
595
|
|
|
554
|
-
#### Parameters[](#parameters-
|
|
596
|
+
#### Parameters[](#parameters-8 "Direct link to Parameters")
|
|
555
597
|
|
|
556
598
|
| Parameter | Type |
|
|
557
599
|
| --------- | ------------- |
|
|
558
600
|
| `router` | `Router` |
|
|
559
601
|
| `config` | `RouteConfig` |
|
|
560
602
|
|
|
561
|
-
#### Returns[](#returns-
|
|
603
|
+
#### Returns[](#returns-13 "Direct link to Returns")
|
|
562
604
|
|
|
563
605
|
`void`
|
|
564
606
|
|
|
@@ -571,11 +613,11 @@ setup(): Promise<void>;
|
|
|
571
613
|
|
|
572
614
|
```
|
|
573
615
|
|
|
574
|
-
#### Returns[](#returns-
|
|
616
|
+
#### Returns[](#returns-14 "Direct link to Returns")
|
|
575
617
|
|
|
576
618
|
`Promise`<`void`>
|
|
577
619
|
|
|
578
|
-
#### Implementation of[](#implementation-of-
|
|
620
|
+
#### Implementation of[](#implementation-of-8 "Direct link to Implementation of")
|
|
579
621
|
|
|
580
622
|
```ts
|
|
581
623
|
BasePlugin.setup
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
function createApp<T>(config: {
|
|
5
5
|
cache?: CacheConfig;
|
|
6
6
|
client?: WorkspaceClient;
|
|
7
|
+
disableInternalTelemetry?: boolean;
|
|
7
8
|
onPluginsReady?: (appkit: PluginMap<T>) => void | Promise<void>;
|
|
8
9
|
plugins?: T;
|
|
9
10
|
telemetry?: TelemetryConfig;
|
|
@@ -23,14 +24,15 @@ Initializes telemetry, cache, and service context, then registers plugins in pha
|
|
|
23
24
|
|
|
24
25
|
## Parameters[](#parameters "Direct link to Parameters")
|
|
25
26
|
|
|
26
|
-
| Parameter
|
|
27
|
-
|
|
|
28
|
-
| `config`
|
|
29
|
-
| `config.cache?`
|
|
30
|
-
| `config.client?`
|
|
31
|
-
| `config.
|
|
32
|
-
| `config.
|
|
33
|
-
| `config.
|
|
27
|
+
| Parameter | Type |
|
|
28
|
+
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
29
|
+
| `config` | { `cache?`: [`CacheConfig`](./docs/api/appkit/Interface.CacheConfig.md); `client?`: `WorkspaceClient`; `disableInternalTelemetry?`: `boolean`; `onPluginsReady?`: (`appkit`: `PluginMap`<`T`>) => `void` \| `Promise`<`void`>; `plugins?`: `T`; `telemetry?`: [`TelemetryConfig`](./docs/api/appkit/Interface.TelemetryConfig.md); } |
|
|
30
|
+
| `config.cache?` | [`CacheConfig`](./docs/api/appkit/Interface.CacheConfig.md) |
|
|
31
|
+
| `config.client?` | `WorkspaceClient` |
|
|
32
|
+
| `config.disableInternalTelemetry?` | `boolean` |
|
|
33
|
+
| `config.onPluginsReady?` | (`appkit`: `PluginMap`<`T`>) => `void` \| `Promise`<`void`> |
|
|
34
|
+
| `config.plugins?` | `T` |
|
|
35
|
+
| `config.telemetry?` | [`TelemetryConfig`](./docs/api/appkit/Interface.TelemetryConfig.md) |
|
|
34
36
|
|
|
35
37
|
## Returns[](#returns "Direct link to Returns")
|
|
36
38
|
|
package/docs/privacy.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Privacy
|
|
2
|
+
|
|
3
|
+
AppKit sends a small amount of anonymized usage telemetry to Databricks so the team can understand how the SDK is used and prioritize improvements. This page documents exactly what is sent, when, and how to turn it off.
|
|
4
|
+
|
|
5
|
+
## What we collect[](#what-we-collect "Direct link to What we collect")
|
|
6
|
+
|
|
7
|
+
Every event is a single record with three top-level fields:
|
|
8
|
+
|
|
9
|
+
| Field | Type | Source |
|
|
10
|
+
| ---------------- | ------ | ---------------------------------------------------- |
|
|
11
|
+
| `event_name` | enum | One of `APP_STARTUP`, `HEARTBEAT`, `REQUEST_METRICS` |
|
|
12
|
+
| `app_id` | string | The app's OAuth client UUID (`DATABRICKS_CLIENT_ID`) |
|
|
13
|
+
| `appkit_version` | string | The AppKit SDK version |
|
|
14
|
+
|
|
15
|
+
Each event also carries one of three event-specific bodies:
|
|
16
|
+
|
|
17
|
+
* **`APP_STARTUP`** — emitted once when `createApp` finishes booting. Empty body.
|
|
18
|
+
|
|
19
|
+
* **`HEARTBEAT`** — emitted every five minutes from a running app. Empty body.
|
|
20
|
+
|
|
21
|
+
* **`REQUEST_METRICS`** — emitted once per minute, one record per HTTP endpoint that received traffic in the window. Each record contains:
|
|
22
|
+
|
|
23
|
+
<!-- -->
|
|
24
|
+
|
|
25
|
+
* `endpoint` — the route template (e.g. `GET /api/genie/:space_id/messages`), never the raw request URL or any user-provided values.
|
|
26
|
+
* `request_count`
|
|
27
|
+
* `request_latency_ms_avg`
|
|
28
|
+
* `response_count_http4xx`
|
|
29
|
+
* `response_count_http5xx`
|
|
30
|
+
|
|
31
|
+
## How to opt out[](#how-to-opt-out "Direct link to How to opt out")
|
|
32
|
+
|
|
33
|
+
Set any one of the following:
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
DISABLE_APPKIT_INTERNAL_TELEMETRY=true
|
|
37
|
+
DO_NOT_TRACK=1
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Either fully disables the reporter — no events are emitted and no network calls are made.
|
package/llms.txt
CHANGED
|
@@ -29,6 +29,7 @@ npx @databricks/appkit docs <query>
|
|
|
29
29
|
- [Development](./docs/development.md): AppKit provides multiple development workflows to suit different needs: local development with hot reload, AI-assisted development with Agent Skills, and remote tunneling to deployed backends.
|
|
30
30
|
- [FAQ](./docs/faq.md): Integrations
|
|
31
31
|
- [Plugins](./docs/plugins.md): Plugins are modular extensions that add capabilities to your AppKit application. They follow a defined lifecycle and have access to shared services like caching, telemetry, and streaming.
|
|
32
|
+
- [Privacy](./docs/privacy.md): AppKit sends a small amount of anonymized usage telemetry to Databricks
|
|
32
33
|
|
|
33
34
|
## Development
|
|
34
35
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@databricks/appkit",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.32.0",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"packageManager": "pnpm@10.21.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@ast-grep/napi": "0.37.0",
|
|
46
46
|
"@databricks/lakebase": "0.3.0",
|
|
47
|
-
"@databricks/sdk-experimental": "0.
|
|
47
|
+
"@databricks/sdk-experimental": "0.17.0",
|
|
48
48
|
"@opentelemetry/api": "1.9.0",
|
|
49
49
|
"@opentelemetry/api-logs": "0.208.0",
|
|
50
50
|
"@opentelemetry/auto-instrumentations-node": "0.67.2",
|
|
@@ -63,6 +63,8 @@
|
|
|
63
63
|
"@types/semver": "7.7.1",
|
|
64
64
|
"dotenv": "16.6.1",
|
|
65
65
|
"express": "4.22.0",
|
|
66
|
+
"get-port": "7.2.0",
|
|
67
|
+
"js-yaml": "4.1.1",
|
|
66
68
|
"obug": "2.1.1",
|
|
67
69
|
"pg": "8.18.0",
|
|
68
70
|
"picocolors": "1.1.1",
|
|
@@ -78,6 +80,7 @@
|
|
|
78
80
|
"devDependencies": {
|
|
79
81
|
"@opentelemetry/context-async-hooks": "2.6.1",
|
|
80
82
|
"@types/express": "4.17.25",
|
|
83
|
+
"@types/js-yaml": "4.0.9",
|
|
81
84
|
"@types/json-schema": "7.0.15",
|
|
82
85
|
"@types/pg": "8.16.0",
|
|
83
86
|
"@types/ws": "8.18.1",
|