@databricks/appkit 0.47.1 → 0.49.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.
Files changed (78) hide show
  1. package/CLAUDE.md +11 -1
  2. package/dist/agents/databricks.d.ts +24 -7
  3. package/dist/agents/databricks.d.ts.map +1 -1
  4. package/dist/agents/databricks.js +25 -0
  5. package/dist/agents/databricks.js.map +1 -1
  6. package/dist/agents/supervisor-api.d.ts +362 -0
  7. package/dist/agents/supervisor-api.d.ts.map +1 -0
  8. package/dist/agents/supervisor-api.js +498 -0
  9. package/dist/agents/supervisor-api.js.map +1 -0
  10. package/dist/appkit/package.js +1 -1
  11. package/dist/beta.d.ts +2 -1
  12. package/dist/beta.js +2 -1
  13. package/dist/cli/commands/lint.js +6 -0
  14. package/dist/cli/commands/lint.js.map +1 -1
  15. package/dist/connectors/serving/client.d.ts +24 -0
  16. package/dist/connectors/serving/client.d.ts.map +1 -0
  17. package/dist/connectors/serving/client.js +34 -14
  18. package/dist/connectors/serving/client.js.map +1 -1
  19. package/dist/core/agent/run-agent.d.ts.map +1 -1
  20. package/dist/core/agent/run-agent.js +51 -2
  21. package/dist/core/agent/run-agent.js.map +1 -1
  22. package/dist/core/agent/types.d.ts +19 -3
  23. package/dist/core/agent/types.d.ts.map +1 -1
  24. package/dist/core/agent/types.js.map +1 -1
  25. package/dist/core/appkit.d.ts.map +1 -1
  26. package/dist/core/appkit.js +39 -1
  27. package/dist/core/appkit.js.map +1 -1
  28. package/dist/index.js +2 -2
  29. package/dist/plugins/agents/agents.d.ts.map +1 -1
  30. package/dist/plugins/agents/agents.js +65 -5
  31. package/dist/plugins/agents/agents.js.map +1 -1
  32. package/dist/plugins/files/plugin.js +2 -2
  33. package/dist/plugins/jobs/plugin.js +2 -2
  34. package/dist/plugins/serving/serving.js +2 -2
  35. package/dist/plugins/ui-variants/choice-sink.js +70 -0
  36. package/dist/plugins/ui-variants/choice-sink.js.map +1 -0
  37. package/dist/plugins/ui-variants/index.js +94 -0
  38. package/dist/plugins/ui-variants/index.js.map +1 -0
  39. package/dist/plugins/ui-variants/manifest.js +17 -0
  40. package/dist/plugins/ui-variants/manifest.js.map +1 -0
  41. package/dist/registry/manifest-loader.d.ts +1 -1
  42. package/dist/schemas/manifest.d.ts +1 -0
  43. package/dist/schemas/manifest.d.ts.map +1 -1
  44. package/dist/schemas/manifest.js +1 -0
  45. package/dist/schemas/manifest.js.map +1 -1
  46. package/dist/shared/src/agent.d.ts +28 -0
  47. package/dist/shared/src/agent.d.ts.map +1 -1
  48. package/dist/shared/src/plugin.d.ts +3 -1
  49. package/dist/shared/src/plugin.d.ts.map +1 -1
  50. package/dist/shared/src/schemas/manifest.d.ts +3 -2
  51. package/dist/shared/src/schemas/manifest.d.ts.map +1 -1
  52. package/dist/stream/index.js +1 -0
  53. package/dist/stream/sse-reader.js +86 -0
  54. package/dist/stream/sse-reader.js.map +1 -0
  55. package/docs/api/appkit/Class.DatabricksAdapter.md +34 -0
  56. package/docs/api/appkit/Class.SupervisorApiAdapter.md +121 -0
  57. package/docs/api/appkit/Function.fromSupervisorApi.md +63 -0
  58. package/docs/api/appkit/Function.isSupervisorTool.md +18 -0
  59. package/docs/api/appkit/Interface.AgentAdapter.md +24 -0
  60. package/docs/api/appkit/Interface.AgentInput.md +13 -0
  61. package/docs/api/appkit/Interface.HostedSupervisorTool.md +21 -0
  62. package/docs/api/appkit/Interface.PluginManifest.md +27 -9
  63. package/docs/api/appkit/Interface.SupervisorApiAdapterOptions.md +38 -0
  64. package/docs/api/appkit/Interface.SupervisorExtension.md +12 -0
  65. package/docs/api/appkit/Interface.WorkspaceClientLike.md +67 -0
  66. package/docs/api/appkit/TypeAlias.AgentTool.md +3 -2
  67. package/docs/api/appkit/TypeAlias.ResolvedToolEntry.md +167 -0
  68. package/docs/api/appkit/TypeAlias.SupervisorTool.md +45 -0
  69. package/docs/api/appkit/Variable.SUPERVISOR_EXTENSION_KEY.md +8 -0
  70. package/docs/api/appkit/Variable.supervisorTools.md +176 -0
  71. package/docs/api/appkit.md +118 -108
  72. package/docs/plugins/agents.md +131 -1
  73. package/docs/plugins/manifest.md +12 -11
  74. package/llms.txt +11 -1
  75. package/package.json +2 -1
  76. package/sbom.cdx.json +1 -1
  77. package/scripts/postinstall.js +0 -1
  78. package/skills/appkit-ui-variants/SKILL.md +183 -0
@@ -22,8 +22,175 @@ type ResolvedToolEntry =
22
22
  agentName: string;
23
23
  def: AgentToolDefinition;
24
24
  source: "subagent";
25
+ }
26
+ | {
27
+ def: AgentToolDefinition;
28
+ source: "hosted-supervisor";
29
+ spec: SupervisorTool;
25
30
  };
26
31
 
27
32
  ```
28
33
 
29
34
  Internal tool-index entry after a tool record has been resolved to a dispatchable form.
35
+
36
+ ## Type Declaration[​](#type-declaration "Direct link to Type Declaration")
37
+
38
+ ```ts
39
+ {
40
+ def: AgentToolDefinition;
41
+ localName: string;
42
+ pluginName: string;
43
+ source: "toolkit";
44
+ }
45
+
46
+ ```
47
+
48
+ ### def[​](#def "Direct link to def")
49
+
50
+ ```ts
51
+ def: AgentToolDefinition;
52
+
53
+ ```
54
+
55
+ ### localName[​](#localname "Direct link to localName")
56
+
57
+ ```ts
58
+ localName: string;
59
+
60
+ ```
61
+
62
+ ### pluginName[​](#pluginname "Direct link to pluginName")
63
+
64
+ ```ts
65
+ pluginName: string;
66
+
67
+ ```
68
+
69
+ ### source[​](#source "Direct link to source")
70
+
71
+ ```ts
72
+ source: "toolkit";
73
+
74
+ ```
75
+
76
+ ```ts
77
+ {
78
+ def: AgentToolDefinition;
79
+ functionTool: FunctionTool;
80
+ source: "function";
81
+ }
82
+
83
+ ```
84
+
85
+ ### def[​](#def-1 "Direct link to def")
86
+
87
+ ```ts
88
+ def: AgentToolDefinition;
89
+
90
+ ```
91
+
92
+ ### functionTool[​](#functiontool "Direct link to functionTool")
93
+
94
+ ```ts
95
+ functionTool: FunctionTool;
96
+
97
+ ```
98
+
99
+ ### source[​](#source-1 "Direct link to source")
100
+
101
+ ```ts
102
+ source: "function";
103
+
104
+ ```
105
+
106
+ ```ts
107
+ {
108
+ def: AgentToolDefinition;
109
+ mcpToolName: string;
110
+ source: "mcp";
111
+ }
112
+
113
+ ```
114
+
115
+ ### def[​](#def-2 "Direct link to def")
116
+
117
+ ```ts
118
+ def: AgentToolDefinition;
119
+
120
+ ```
121
+
122
+ ### mcpToolName[​](#mcptoolname "Direct link to mcpToolName")
123
+
124
+ ```ts
125
+ mcpToolName: string;
126
+
127
+ ```
128
+
129
+ ### source[​](#source-2 "Direct link to source")
130
+
131
+ ```ts
132
+ source: "mcp";
133
+
134
+ ```
135
+
136
+ ```ts
137
+ {
138
+ agentName: string;
139
+ def: AgentToolDefinition;
140
+ source: "subagent";
141
+ }
142
+
143
+ ```
144
+
145
+ ### agentName[​](#agentname "Direct link to agentName")
146
+
147
+ ```ts
148
+ agentName: string;
149
+
150
+ ```
151
+
152
+ ### def[​](#def-3 "Direct link to def")
153
+
154
+ ```ts
155
+ def: AgentToolDefinition;
156
+
157
+ ```
158
+
159
+ ### source[​](#source-3 "Direct link to source")
160
+
161
+ ```ts
162
+ source: "subagent";
163
+
164
+ ```
165
+
166
+ ```ts
167
+ {
168
+ def: AgentToolDefinition;
169
+ source: "hosted-supervisor";
170
+ spec: SupervisorTool;
171
+ }
172
+
173
+ ```
174
+
175
+ ### def[​](#def-4 "Direct link to def")
176
+
177
+ ```ts
178
+ def: AgentToolDefinition;
179
+
180
+ ```
181
+
182
+ ### source[​](#source-4 "Direct link to source")
183
+
184
+ ```ts
185
+ source: "hosted-supervisor";
186
+
187
+ ```
188
+
189
+ Adapter-side hosted tool (executed by the model-host, not by the Node process). Today: Supervisor API hosted tools (Genie spaces, UC functions, etc.). The `spec` is opaque to the agents plugin — it routes the entry into `AgentInput.extensions` for the adapter that declared the matching `acceptsExtensions` key. `def` is a synthetic placeholder kept so the index has a uniform shape; it is intentionally NOT included in the `tools` array passed to `adapter.run()` (those entries are not callable functions).
190
+
191
+ ### spec[​](#spec "Direct link to spec")
192
+
193
+ ```ts
194
+ spec: SupervisorTool;
195
+
196
+ ```
@@ -0,0 +1,45 @@
1
+ # Type Alias: SupervisorTool
2
+
3
+ ```ts
4
+ type SupervisorTool =
5
+ | {
6
+ genie_space: {
7
+ description: string;
8
+ id: string;
9
+ };
10
+ type: "genie_space";
11
+ }
12
+ | {
13
+ type: "uc_function";
14
+ uc_function: {
15
+ description: string;
16
+ name: string;
17
+ };
18
+ }
19
+ | {
20
+ knowledge_assistant: {
21
+ description: string;
22
+ knowledge_assistant_id: string;
23
+ };
24
+ type: "knowledge_assistant";
25
+ }
26
+ | {
27
+ app: {
28
+ description: string;
29
+ name: string;
30
+ };
31
+ type: "app";
32
+ }
33
+ | {
34
+ type: "uc_connection";
35
+ uc_connection: {
36
+ description: string;
37
+ name: string;
38
+ };
39
+ };
40
+
41
+ ```
42
+
43
+ Tools supported by the Databricks AI Gateway Responses API. The shapes match the wire format the endpoint expects, so the adapter passes the array straight into the request body.
44
+
45
+ This is an adapter-internal wire type. Application code authors tools via the [supervisorTools](./docs/api/appkit/Variable.supervisorTools.md) factories, which return tagged [HostedSupervisorTool](./docs/api/appkit/Interface.HostedSupervisorTool.md) records — the agents plugin then unwraps the `.spec` when routing through [AgentInput.extensions](./docs/api/appkit/Interface.AgentInput.md#extensions).
@@ -0,0 +1,8 @@
1
+ # Variable: SUPERVISOR\_EXTENSION\_KEY
2
+
3
+ ```ts
4
+ const SUPERVISOR_EXTENSION_KEY: "databricks.supervisor";
5
+
6
+ ```
7
+
8
+ Namespace key under which the adapter reads its hosted-tool payload from [AgentInput.extensions](./docs/api/appkit/Interface.AgentInput.md#extensions). Exported so the agents plugin and standalone `runAgent` (the producers) can write under the same key the adapter reads.
@@ -0,0 +1,176 @@
1
+ # Variable: supervisorTools
2
+
3
+ ```ts
4
+ const supervisorTools: {
5
+ app: (__namedParameters: {
6
+ description: string;
7
+ name: string;
8
+ }) => HostedSupervisorTool;
9
+ genieSpace: (__namedParameters: {
10
+ description: string;
11
+ id: string;
12
+ }) => HostedSupervisorTool;
13
+ knowledgeAssistant: (__namedParameters: {
14
+ description: string;
15
+ knowledgeAssistantId: string;
16
+ }) => HostedSupervisorTool;
17
+ ucConnection: (__namedParameters: {
18
+ description: string;
19
+ name: string;
20
+ }) => HostedSupervisorTool;
21
+ ucFunction: (__namedParameters: {
22
+ description: string;
23
+ name: string;
24
+ }) => HostedSupervisorTool;
25
+ };
26
+
27
+ ```
28
+
29
+ Concise factories for declaring Supervisor API tools.
30
+
31
+ Each factory accepts a single named-options object: routing-critical strings (`id`, `name`, `description`) get labels at the call site so "we swapped the args and didn't notice for two weeks" bugs are impossible.
32
+
33
+ `description` is required: SA's protobuf validation rejects `null`/`""`, AND the LLM running on SA reads this string to decide when to route to the tool. Two genie spaces both labelled "Genie space" give the model nothing to discriminate on, so callers always own the routing hint.
34
+
35
+ ⚠ The `description` is read by the LLM at routing time — it is a prompt-injection sink. Do **not** derive it from untrusted input (user messages, request bodies, external systems). Treat it as application configuration. (CWE-1427)
36
+
37
+ ## Type Declaration[​](#type-declaration "Direct link to Type Declaration")
38
+
39
+ ### app()[​](#app "Direct link to app()")
40
+
41
+ ```ts
42
+ app: (__namedParameters: {
43
+ description: string;
44
+ name: string;
45
+ }) => HostedSupervisorTool;
46
+
47
+ ```
48
+
49
+ #### Parameters[​](#parameters "Direct link to Parameters")
50
+
51
+ | Parameter | Type |
52
+ | ------------------------------- | ---------------------------------------------- |
53
+ | `__namedParameters` | { `description`: `string`; `name`: `string`; } |
54
+ | `__namedParameters.description` | `string` |
55
+ | `__namedParameters.name` | `string` |
56
+
57
+ #### Returns[​](#returns "Direct link to Returns")
58
+
59
+ [`HostedSupervisorTool`](./docs/api/appkit/Interface.HostedSupervisorTool.md)
60
+
61
+ ### genieSpace()[​](#geniespace "Direct link to genieSpace()")
62
+
63
+ ```ts
64
+ genieSpace: (__namedParameters: {
65
+ description: string;
66
+ id: string;
67
+ }) => HostedSupervisorTool;
68
+
69
+ ```
70
+
71
+ #### Parameters[​](#parameters-1 "Direct link to Parameters")
72
+
73
+ | Parameter | Type |
74
+ | ------------------------------- | -------------------------------------------- |
75
+ | `__namedParameters` | { `description`: `string`; `id`: `string`; } |
76
+ | `__namedParameters.description` | `string` |
77
+ | `__namedParameters.id` | `string` |
78
+
79
+ #### Returns[​](#returns-1 "Direct link to Returns")
80
+
81
+ [`HostedSupervisorTool`](./docs/api/appkit/Interface.HostedSupervisorTool.md)
82
+
83
+ ### knowledgeAssistant()[​](#knowledgeassistant "Direct link to knowledgeAssistant()")
84
+
85
+ ```ts
86
+ knowledgeAssistant: (__namedParameters: {
87
+ description: string;
88
+ knowledgeAssistantId: string;
89
+ }) => HostedSupervisorTool;
90
+
91
+ ```
92
+
93
+ #### Parameters[​](#parameters-2 "Direct link to Parameters")
94
+
95
+ | Parameter | Type |
96
+ | ---------------------------------------- | -------------------------------------------------------------- |
97
+ | `__namedParameters` | { `description`: `string`; `knowledgeAssistantId`: `string`; } |
98
+ | `__namedParameters.description` | `string` |
99
+ | `__namedParameters.knowledgeAssistantId` | `string` |
100
+
101
+ #### Returns[​](#returns-2 "Direct link to Returns")
102
+
103
+ [`HostedSupervisorTool`](./docs/api/appkit/Interface.HostedSupervisorTool.md)
104
+
105
+ ### ucConnection()[​](#ucconnection "Direct link to ucConnection()")
106
+
107
+ ```ts
108
+ ucConnection: (__namedParameters: {
109
+ description: string;
110
+ name: string;
111
+ }) => HostedSupervisorTool;
112
+
113
+ ```
114
+
115
+ #### Parameters[​](#parameters-3 "Direct link to Parameters")
116
+
117
+ | Parameter | Type |
118
+ | ------------------------------- | ---------------------------------------------- |
119
+ | `__namedParameters` | { `description`: `string`; `name`: `string`; } |
120
+ | `__namedParameters.description` | `string` |
121
+ | `__namedParameters.name` | `string` |
122
+
123
+ #### Returns[​](#returns-3 "Direct link to Returns")
124
+
125
+ [`HostedSupervisorTool`](./docs/api/appkit/Interface.HostedSupervisorTool.md)
126
+
127
+ ### ucFunction()[​](#ucfunction "Direct link to ucFunction()")
128
+
129
+ ```ts
130
+ ucFunction: (__namedParameters: {
131
+ description: string;
132
+ name: string;
133
+ }) => HostedSupervisorTool;
134
+
135
+ ```
136
+
137
+ #### Parameters[​](#parameters-4 "Direct link to Parameters")
138
+
139
+ | Parameter | Type |
140
+ | ------------------------------- | ---------------------------------------------- |
141
+ | `__namedParameters` | { `description`: `string`; `name`: `string`; } |
142
+ | `__namedParameters.description` | `string` |
143
+ | `__namedParameters.name` | `string` |
144
+
145
+ #### Returns[​](#returns-4 "Direct link to Returns")
146
+
147
+ [`HostedSupervisorTool`](./docs/api/appkit/Interface.HostedSupervisorTool.md)
148
+
149
+ ## Example[​](#example "Direct link to Example")
150
+
151
+ ```ts
152
+ import { createAgent } from "@databricks/appkit";
153
+ import {
154
+ agents,
155
+ DatabricksAdapter,
156
+ supervisorTools,
157
+ } from "@databricks/appkit/beta";
158
+
159
+ const assistant = createAgent({
160
+ instructions: "You are a helpful assistant.",
161
+ model: DatabricksAdapter.fromSupervisorApi({
162
+ model: "databricks-claude-sonnet-4",
163
+ }),
164
+ tools: () => ({
165
+ nyc: supervisorTools.genieSpace({
166
+ id: "01ABCDEF12345678",
167
+ description: "NYC taxi trip records and zones",
168
+ }),
169
+ add: supervisorTools.ucFunction({
170
+ name: "main.default.add",
171
+ description: "Adds two integers and returns the sum.",
172
+ }),
173
+ }),
174
+ });
175
+
176
+ ```