@databricks/appkit 0.83.0 → 0.84.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 (210) hide show
  1. package/CLAUDE.md +15 -1
  2. package/dist/agents/databricks.d.ts +15 -3
  3. package/dist/agents/databricks.d.ts.map +1 -1
  4. package/dist/agents/databricks.js +25 -8
  5. package/dist/agents/databricks.js.map +1 -1
  6. package/dist/appkit/package.js +1 -1
  7. package/dist/beta.d.ts +2 -2
  8. package/dist/cache/index.d.ts.map +1 -1
  9. package/dist/cache/index.js +6 -1
  10. package/dist/cache/index.js.map +1 -1
  11. package/dist/cli/commands/agent/eval.js +1 -1
  12. package/dist/cli/commands/generate-types.js +1 -1
  13. package/dist/cli/commands/plugin/sync/sync.js +28 -15
  14. package/dist/cli/commands/plugin/sync/sync.js.map +1 -1
  15. package/dist/cli/commands/registry/add.js +3 -11
  16. package/dist/cli/commands/registry/add.js.map +1 -1
  17. package/dist/cli/commands/registry/config-writer.js +1 -1
  18. package/dist/connectors/lakebase/routing-pool.d.ts.map +1 -1
  19. package/dist/connectors/lakebase/routing-pool.js +4 -10
  20. package/dist/connectors/lakebase/routing-pool.js.map +1 -1
  21. package/dist/context/caller-context.d.ts +4 -1
  22. package/dist/context/caller-context.d.ts.map +1 -1
  23. package/dist/context/caller-context.js.map +1 -1
  24. package/dist/context/execution-context.d.ts +29 -1
  25. package/dist/context/execution-context.d.ts.map +1 -1
  26. package/dist/context/execution-context.js +60 -8
  27. package/dist/context/execution-context.js.map +1 -1
  28. package/dist/context/index.d.ts +2 -2
  29. package/dist/context/index.js +2 -1
  30. package/dist/context/request-scope.d.ts +2 -0
  31. package/dist/context/request-scope.js +39 -0
  32. package/dist/context/request-scope.js.map +1 -0
  33. package/dist/context/resource-capabilities.js +59 -0
  34. package/dist/context/resource-capabilities.js.map +1 -0
  35. package/dist/context/scoped-api.js +104 -0
  36. package/dist/context/scoped-api.js.map +1 -0
  37. package/dist/context/service-context.d.ts.map +1 -1
  38. package/dist/context/service-context.js +1 -1
  39. package/dist/context/service-context.js.map +1 -1
  40. package/dist/context/user-context.d.ts +16 -19
  41. package/dist/context/user-context.d.ts.map +1 -1
  42. package/dist/context/user-context.js +30 -3
  43. package/dist/context/user-context.js.map +1 -1
  44. package/dist/core/agent/load-agents.d.ts.map +1 -1
  45. package/dist/core/agent/load-agents.js +5 -2
  46. package/dist/core/agent/load-agents.js.map +1 -1
  47. package/dist/core/agent/run-agent.d.ts +19 -6
  48. package/dist/core/agent/run-agent.d.ts.map +1 -1
  49. package/dist/core/agent/run-agent.js +53 -17
  50. package/dist/core/agent/run-agent.js.map +1 -1
  51. package/dist/core/agent/types.d.ts +18 -1
  52. package/dist/core/agent/types.d.ts.map +1 -1
  53. package/dist/core/agent/types.js.map +1 -1
  54. package/dist/core/appkit.d.ts +4 -3
  55. package/dist/core/appkit.d.ts.map +1 -1
  56. package/dist/core/appkit.js +30 -9
  57. package/dist/core/appkit.js.map +1 -1
  58. package/dist/core/plugin-context.d.ts +14 -15
  59. package/dist/core/plugin-context.d.ts.map +1 -1
  60. package/dist/core/plugin-context.js +24 -14
  61. package/dist/core/plugin-context.js.map +1 -1
  62. package/dist/errors/base.d.ts +2 -2
  63. package/dist/errors/base.js +2 -2
  64. package/dist/errors/base.js.map +1 -1
  65. package/dist/errors/identity-expired.d.ts +14 -0
  66. package/dist/errors/identity-expired.d.ts.map +1 -0
  67. package/dist/errors/identity-expired.js +33 -0
  68. package/dist/errors/identity-expired.js.map +1 -0
  69. package/dist/errors/index.js +1 -0
  70. package/dist/index.d.ts +8 -5
  71. package/dist/index.js +5 -2
  72. package/dist/logging/logger.js +1 -1
  73. package/dist/plugin/execution-result.d.ts +4 -1
  74. package/dist/plugin/execution-result.d.ts.map +1 -1
  75. package/dist/plugin/interceptors/telemetry.js +6 -4
  76. package/dist/plugin/interceptors/telemetry.js.map +1 -1
  77. package/dist/plugin/plugin.d.ts +13 -21
  78. package/dist/plugin/plugin.d.ts.map +1 -1
  79. package/dist/plugin/plugin.js +41 -122
  80. package/dist/plugin/plugin.js.map +1 -1
  81. package/dist/plugins/agents/agents.d.ts +12 -0
  82. package/dist/plugins/agents/agents.d.ts.map +1 -1
  83. package/dist/plugins/agents/agents.js +65 -15
  84. package/dist/plugins/agents/agents.js.map +1 -1
  85. package/dist/plugins/agents/auth-mode.js +42 -0
  86. package/dist/plugins/agents/auth-mode.js.map +1 -0
  87. package/dist/plugins/agents/index.d.ts +1 -1
  88. package/dist/plugins/agents/mlflow.js +11 -3
  89. package/dist/plugins/agents/mlflow.js.map +1 -1
  90. package/dist/plugins/agents/tool-dispatch.js +9 -1
  91. package/dist/plugins/agents/tool-dispatch.js.map +1 -1
  92. package/dist/plugins/ai-search/ai-search.d.ts.map +1 -1
  93. package/dist/plugins/ai-search/ai-search.js +4 -4
  94. package/dist/plugins/ai-search/ai-search.js.map +1 -1
  95. package/dist/plugins/analytics/analytics.d.ts +2 -2
  96. package/dist/plugins/analytics/analytics.js +6 -6
  97. package/dist/plugins/analytics/analytics.js.map +1 -1
  98. package/dist/plugins/database/crud/contract.js +2 -2
  99. package/dist/plugins/database/crud/contract.js.map +1 -1
  100. package/dist/plugins/files/plugin.d.ts +10 -4
  101. package/dist/plugins/files/plugin.d.ts.map +1 -1
  102. package/dist/plugins/files/plugin.js +34 -13
  103. package/dist/plugins/files/plugin.js.map +1 -1
  104. package/dist/plugins/genie/genie.d.ts +9 -0
  105. package/dist/plugins/genie/genie.d.ts.map +1 -1
  106. package/dist/plugins/genie/genie.js +12 -3
  107. package/dist/plugins/genie/genie.js.map +1 -1
  108. package/dist/plugins/genie/manifest.js +1 -0
  109. package/dist/plugins/jobs/plugin.js +2 -2
  110. package/dist/plugins/jobs/plugin.js.map +1 -1
  111. package/dist/plugins/lakebase/lakebase.d.ts +10 -17
  112. package/dist/plugins/lakebase/lakebase.d.ts.map +1 -1
  113. package/dist/plugins/lakebase/lakebase.js +12 -17
  114. package/dist/plugins/lakebase/lakebase.js.map +1 -1
  115. package/dist/plugins/server/client-config-sanitizer.js +1 -4
  116. package/dist/plugins/server/client-config-sanitizer.js.map +1 -1
  117. package/dist/plugins/server/dev-obo-middleware.js +60 -0
  118. package/dist/plugins/server/dev-obo-middleware.js.map +1 -0
  119. package/dist/plugins/server/index.d.ts.map +1 -1
  120. package/dist/plugins/server/index.js +5 -2
  121. package/dist/plugins/server/index.js.map +1 -1
  122. package/dist/plugins/server/remote-tunnel/remote-tunnel-manager.js +3 -3
  123. package/dist/plugins/server/remote-tunnel/remote-tunnel-manager.js.map +1 -1
  124. package/dist/plugins/server/static-server.js +3 -3
  125. package/dist/plugins/server/static-server.js.map +1 -1
  126. package/dist/plugins/server/utils.js +3 -3
  127. package/dist/plugins/server/utils.js.map +1 -1
  128. package/dist/plugins/server/vite-dev-server.js +4 -4
  129. package/dist/plugins/server/vite-dev-server.js.map +1 -1
  130. package/dist/plugins/serving/manifest.js +1 -0
  131. package/dist/plugins/serving/serving.js +6 -6
  132. package/dist/plugins/serving/serving.js.map +1 -1
  133. package/dist/schemas/manifest.d.ts +35 -1
  134. package/dist/schemas/manifest.d.ts.map +1 -1
  135. package/dist/schemas/manifest.js +112 -4
  136. package/dist/schemas/manifest.js.map +1 -1
  137. package/dist/shared/src/dev-obo.js +86 -0
  138. package/dist/shared/src/dev-obo.js.map +1 -0
  139. package/dist/shared/src/index.d.ts +1 -1
  140. package/dist/shared/src/plugin.d.ts +12 -1
  141. package/dist/shared/src/plugin.d.ts.map +1 -1
  142. package/dist/shared/src/schemas/manifest.d.ts +41 -33
  143. package/dist/shared/src/schemas/manifest.d.ts.map +1 -1
  144. package/dist/shared/src/schemas/manifest.js +43 -4
  145. package/dist/shared/src/schemas/manifest.js.map +1 -1
  146. package/dist/stream/stream-manager.d.ts.map +1 -1
  147. package/dist/stream/stream-manager.js +5 -2
  148. package/dist/stream/stream-manager.js.map +1 -1
  149. package/dist/telemetry/execution-span-processor.js +21 -0
  150. package/dist/telemetry/execution-span-processor.js.map +1 -0
  151. package/dist/telemetry/telemetry-manager.js +2 -1
  152. package/dist/telemetry/telemetry-manager.js.map +1 -1
  153. package/dist/testing/create-test-app.d.ts +2 -2
  154. package/dist/testing/create-test-app.js.map +1 -1
  155. package/dist/testing/test-plugin-context.d.ts +3 -12
  156. package/dist/testing/test-plugin-context.d.ts.map +1 -1
  157. package/dist/testing/test-plugin-context.js +24 -16
  158. package/dist/testing/test-plugin-context.js.map +1 -1
  159. package/dist/type-generator/database/generate.js +3 -3
  160. package/dist/type-generator/database/generate.js.map +1 -1
  161. package/dist/type-generator/migration.js +2 -2
  162. package/dist/type-generator/migration.js.map +1 -1
  163. package/dist/type-generator/serving/server-file-extractor.js +3 -3
  164. package/dist/type-generator/serving/server-file-extractor.js.map +1 -1
  165. package/dist/utils/is-plain-object.js +11 -0
  166. package/dist/utils/is-plain-object.js.map +1 -0
  167. package/docs/api/appkit/Class.AppKitError.md +2 -1
  168. package/docs/api/appkit/Class.AuthenticationError.md +1 -1
  169. package/docs/api/appkit/Class.ConfigurationError.md +1 -1
  170. package/docs/api/appkit/Class.ConnectionError.md +1 -1
  171. package/docs/api/appkit/Class.DatabaseValidationError.md +1 -1
  172. package/docs/api/appkit/Class.ExecutionError.md +1 -1
  173. package/docs/api/appkit/Class.IdentityExpiredError.md +190 -0
  174. package/docs/api/appkit/Class.InitializationError.md +1 -1
  175. package/docs/api/appkit/Class.Plugin.md +8 -12
  176. package/docs/api/appkit/Class.ServerError.md +1 -1
  177. package/docs/api/appkit/Class.ServiceContext.md +169 -0
  178. package/docs/api/appkit/Class.TunnelError.md +1 -1
  179. package/docs/api/appkit/Class.ValidationError.md +1 -1
  180. package/docs/api/appkit/Function.createApp.md +12 -12
  181. package/docs/api/appkit/Function.getCallerContext.md +12 -0
  182. package/docs/api/appkit/Function.getCurrentUserId.md +14 -0
  183. package/docs/api/appkit/Function.getExecutionContext.md +1 -1
  184. package/docs/api/appkit/Function.getUserContext.md +16 -0
  185. package/docs/api/appkit/Function.isInUserContext.md +12 -0
  186. package/docs/api/appkit/Function.isUserContext.md +20 -0
  187. package/docs/api/appkit/Function.runAgent.md +1 -1
  188. package/docs/api/appkit/Function.runInCallerContext.md +27 -0
  189. package/docs/api/appkit/Function.runInUserContext.md +29 -0
  190. package/docs/api/appkit/Interface.AgentDefinition.md +11 -0
  191. package/docs/api/appkit/Interface.AgentsPluginConfig.md +11 -0
  192. package/docs/api/appkit/Interface.CallerContext.md +13 -0
  193. package/docs/api/appkit/Interface.IndexConfig.md +1 -1
  194. package/docs/api/appkit/Interface.PluginManifest.md +9 -1
  195. package/docs/api/appkit/Interface.RegisteredAgent.md +11 -0
  196. package/docs/api/appkit/Interface.RunAgentInput.md +45 -1
  197. package/docs/api/appkit/TypeAlias.AgentAuth.md +8 -0
  198. package/docs/api/appkit/TypeAlias.AppKitApi.md +35 -0
  199. package/docs/api/appkit/TypeAlias.ExecutionContext.md +4 -1
  200. package/docs/api/appkit/TypeAlias.ExecutionResult.md +65 -0
  201. package/docs/api/appkit/TypeAlias.ScopedPluginMap.md +12 -0
  202. package/docs/api/appkit/TypeAlias.UserContext.md +109 -0
  203. package/docs/api/appkit/TypeAlias.UserScopedApp.md +39 -0
  204. package/docs/api/appkit.md +14 -0
  205. package/docs/plugins/agents.md +45 -0
  206. package/docs/plugins/execution-context.md +101 -50
  207. package/docs/plugins/lakebase.md +6 -82
  208. package/llms.txt +15 -1
  209. package/package.json +1 -1
  210. package/sbom.cdx.json +1 -1
@@ -9,7 +9,7 @@ Standalone agent execution without `createApp`. Resolves the adapter, binds inli
9
9
 
10
10
  Limitations vs. running through the agents() plugin:
11
11
 
12
- * **No OBO and no approval gate** — there is no HTTP request, so plugin tools run as the service principal. The agents-plugin approval gate that prompts for human confirmation on `effect: "write" | "update" | "destructive"` tools is also absent. LLM-controlled tool arguments flow straight through to the SP. Treat standalone runAgent as a trusted-prompt environment (CI, batch eval, internal scripts) — not as an exposed user-facing surface.
12
+ * **No approval gate**: tools inherit the run's principal, SP by default. Explicit caller credentials enable user execution. The agents-plugin gate that prompts for human confirmation on `effect: "write" | "update" | "destructive"` tools is also absent. LLM-controlled tool arguments flow straight through to the tools. Treat standalone runAgent as a trusted-prompt environment (CI, batch eval, internal scripts), not as an exposed user-facing surface.
13
13
  * **Hosted tools (MCP) are not supported** — they require a live MCP client that only exists inside the agents plugin's lifecycle. `runAgent` rejects them at index-build time with a clear error.
14
14
  * **Sub-agents** (`agents: { ... }` on the def) are executed as nested `runAgent` calls with no shared thread state. Plugin instances ARE shared across the recursion (same cache as the parent).
15
15
  * **Plugin tools** (used inside the function form via `plugins.<name>.toolkit(...)`) require passing `plugins: [...]` via `RunAgentInput`. Each plugin in that array is constructed once, `attachContext({})` and `await setup()` are called eagerly, and the resulting instance is shared across the top-level run and all sub-agent recursions. Plugins whose `setup()` requires runtime that only `createApp` provides (e.g. `WorkspaceClient`, `ServiceContext`, `PluginContext`) throw at standalone-init time with a clear "use createApp instead" message — not mid-stream.
@@ -0,0 +1,27 @@
1
+ # Function: runInCallerContext()
2
+
3
+ ```ts
4
+ function runInCallerContext<T>(callerContext: CallerContext, fn: () => T): T;
5
+
6
+ ```
7
+
8
+ Run a function with an immutable snapshot of the caller context. Nested and concurrent scopes keep their own identities.
9
+
10
+ ## Type Parameters[​](#type-parameters "Direct link to Type Parameters")
11
+
12
+ | Type Parameter |
13
+ | -------------- |
14
+ | `T` |
15
+
16
+ ## Parameters[​](#parameters "Direct link to Parameters")
17
+
18
+ | Parameter | Type | Description |
19
+ | --------------- | --------------------------------------------------------------------- | ------------------------- |
20
+ | `callerContext` | [`CallerContext`](./docs/api/appkit/Interface.CallerContext.md) | The caller context to use |
21
+ | `fn` | () => `T` | The function to run |
22
+
23
+ ## Returns[​](#returns "Direct link to Returns")
24
+
25
+ `T`
26
+
27
+ The result of the function
@@ -0,0 +1,29 @@
1
+ # ~~Function: runInUserContext()~~
2
+
3
+ ```ts
4
+ function runInUserContext<T>(userContext:
5
+ | UserContext
6
+ | CallerContext & Pick<UserContext, "warehouseId">, fn: () => T): T;
7
+
8
+ ```
9
+
10
+ ## Type Parameters[​](#type-parameters "Direct link to Type Parameters")
11
+
12
+ | Type Parameter |
13
+ | -------------- |
14
+ | `T` |
15
+
16
+ ## Parameters[​](#parameters "Direct link to Parameters")
17
+
18
+ | Parameter | Type |
19
+ | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
20
+ | `userContext` | \| [`UserContext`](./docs/api/appkit/TypeAlias.UserContext.md) \| [`CallerContext`](./docs/api/appkit/Interface.CallerContext.md) & `Pick`<[`UserContext`](./docs/api/appkit/TypeAlias.UserContext.md), `"warehouseId"`> |
21
+ | `fn` | () => `T` |
22
+
23
+ ## Returns[​](#returns "Direct link to Returns")
24
+
25
+ `T`
26
+
27
+ ## Deprecated[​](#deprecated "Direct link to Deprecated")
28
+
29
+ Use runInCallerContext.
@@ -13,6 +13,17 @@ Sub-agents, exposed as `agent-<key>` tools on this agent.
13
13
 
14
14
  ***
15
15
 
16
+ ### auth?[​](#auth "Direct link to auth?")
17
+
18
+ ```ts
19
+ optional auth: "on-behalf-of-user";
20
+
21
+ ```
22
+
23
+ Run this agent on behalf of the signed-in user: the model call, plugin tools, hand-rolled tools, and sub-agents all use the user's credentials. Overrides `agents({ auth })` for this agent. Omit for the default, where the model and hand-rolled tools run as the app service principal and plugin tools run as the user.
24
+
25
+ ***
26
+
16
27
  ### baseSystemPrompt?[​](#basesystemprompt "Direct link to baseSystemPrompt?")
17
28
 
18
29
  ```ts
@@ -60,6 +60,17 @@ Milliseconds to wait before auto-denying. Default: 60\_000.
60
60
 
61
61
  ***
62
62
 
63
+ ### auth?[​](#auth "Direct link to auth?")
64
+
65
+ ```ts
66
+ optional auth: "on-behalf-of-user";
67
+
68
+ ```
69
+
70
+ Default identity for agents that don't set their own `auth`. `"on-behalf-of-user"` runs the whole agent as the signed-in user.
71
+
72
+ ***
73
+
63
74
  ### autoInheritSkills?[​](#autoinheritskills "Direct link to autoInheritSkills?")
64
75
 
65
76
  ```ts
@@ -33,6 +33,19 @@ Truncated SHA-256 hash of the caller token, used to detect rotation.
33
33
 
34
34
  ***
35
35
 
36
+ ### ~~warehouseId?~~[​](#warehouseid "Direct link to warehouseid")
37
+
38
+ ```ts
39
+ readonly optional warehouseId: Promise<string>;
40
+
41
+ ```
42
+
43
+ #### Deprecated[​](#deprecated "Direct link to Deprecated")
44
+
45
+ Use getWarehouseId(). Only legacy context access exposes this field.
46
+
47
+ ***
48
+
36
49
  ### workspaceId[​](#workspaceid "Direct link to workspaceId")
37
50
 
38
51
  ```ts
@@ -5,7 +5,7 @@
5
5
  ### auth?[​](#auth "Direct link to auth?")
6
6
 
7
7
  ```ts
8
- optional auth: "service-principal" | "on-behalf-of-user";
8
+ optional auth: "on-behalf-of-user" | "service-principal";
9
9
 
10
10
  ```
11
11
 
@@ -327,13 +327,21 @@ Omit.scaffolding
327
327
 
328
328
  ```ts
329
329
  optional scopes: (
330
+ | "postgres"
331
+ | "sql"
332
+ | "model-serving"
333
+ | "genie"
334
+ | "files"
335
+ | "vector-search"
336
+ | "catalog.connections"
330
337
  | "ai-gateway"
331
338
  | "mcp.external"
332
339
  | "mcp.functions"
333
340
  | "workspace.workspace"
334
341
  | "catalog.catalogs:read"
335
342
  | "catalog.schemas:read"
336
- | "catalog.tables:read")[];
343
+ | "catalog.tables:read"
344
+ | "sql:restricted-query")[];
337
345
 
338
346
  ```
339
347
 
@@ -11,6 +11,17 @@ adapter: AgentAdapter;
11
11
 
12
12
  ***
13
13
 
14
+ ### auth?[​](#auth "Direct link to auth?")
15
+
16
+ ```ts
17
+ optional auth: "on-behalf-of-user";
18
+
19
+ ```
20
+
21
+ Effective identity: the agent's `auth`, else the plugin default.
22
+
23
+ ***
24
+
14
25
  ### baseSystemPrompt?[​](#basesystemprompt "Direct link to baseSystemPrompt?")
15
26
 
16
27
  ```ts
@@ -2,6 +2,50 @@
2
2
 
3
3
  ## Properties[​](#properties "Direct link to Properties")
4
4
 
5
+ ### caller?[​](#caller "Direct link to caller?")
6
+
7
+ ```ts
8
+ optional caller: {
9
+ host: string;
10
+ principal: CallerPrincipal;
11
+ token: string;
12
+ workspaceId: string;
13
+ };
14
+
15
+ ```
16
+
17
+ Explicit user credentials for standalone execution. Host and workspace ID are required, so no CLI profile or service-principal identity is selected. Omit to inherit the ambient scope, or use SP when no caller scope is open. Obtain the token through a trusted authentication flow, not model input.
18
+
19
+ #### host[​](#host "Direct link to host")
20
+
21
+ ```ts
22
+ readonly host: string;
23
+
24
+ ```
25
+
26
+ #### principal[​](#principal "Direct link to principal")
27
+
28
+ ```ts
29
+ readonly principal: CallerPrincipal;
30
+
31
+ ```
32
+
33
+ #### token[​](#token "Direct link to token")
34
+
35
+ ```ts
36
+ readonly token: string;
37
+
38
+ ```
39
+
40
+ #### workspaceId[​](#workspaceid "Direct link to workspaceId")
41
+
42
+ ```ts
43
+ readonly workspaceId: string;
44
+
45
+ ```
46
+
47
+ ***
48
+
5
49
  ### messages[​](#messages "Direct link to messages")
6
50
 
7
51
  ```ts
@@ -20,7 +64,7 @@ optional plugins: PluginData<PluginConstructor, unknown, string>[];
20
64
 
21
65
  ```
22
66
 
23
- Optional plugin list. Required when `def.tools` is the function form `(plugins) => Record<string, AgentTool>` and the function dereferences any plugins. `runAgent` constructs a fresh instance per plugin and dispatches tool calls against it as the service principal (no OBO — there is no HTTP request in standalone mode).
67
+ Optional plugin list. Required when `def.tools` is the function form `(plugins) => Record<string, AgentTool>` and the function dereferences any plugins. `runAgent` constructs a fresh instance per plugin and dispatches tool calls with the run's ambient principal.
24
68
 
25
69
  ***
26
70
 
@@ -0,0 +1,8 @@
1
+ # Type Alias: AgentAuth
2
+
3
+ ```ts
4
+ type AgentAuth = "on-behalf-of-user";
5
+
6
+ ```
7
+
8
+ Identity an agent runs under. The only value is on-behalf-of-user.
@@ -0,0 +1,35 @@
1
+ # Type Alias: AppKitApi\<U>
2
+
3
+ ```ts
4
+ type AppKitApi<U> = PluginMap<U> & {
5
+ asUser: UserScopedApp<U>;
6
+ };
7
+
8
+ ```
9
+
10
+ App instance with plugin exports and an explicit caller-scoped entry point.
11
+
12
+ ## Type Declaration[​](#type-declaration "Direct link to Type Declaration")
13
+
14
+ ### asUser()[​](#asuser "Direct link to asUser()")
15
+
16
+ ```ts
17
+ asUser(req: IAppRequest): UserScopedApp<U>;
18
+
19
+ ```
20
+
21
+ #### Parameters[​](#parameters "Direct link to Parameters")
22
+
23
+ | Parameter | Type |
24
+ | --------- | ------------- |
25
+ | `req` | `IAppRequest` |
26
+
27
+ #### Returns[​](#returns "Direct link to Returns")
28
+
29
+ [`UserScopedApp`](./docs/api/appkit/TypeAlias.UserScopedApp.md)<`U`>
30
+
31
+ ## Type Parameters[​](#type-parameters "Direct link to Type Parameters")
32
+
33
+ | Type Parameter |
34
+ | ----------------------------------------------------------------------------------------------------------------------------------- |
35
+ | `U` *extends* readonly [`PluginData`](./docs/api/appkit/TypeAlias.PluginData.md)<`PluginConstructor`, `unknown`, `string`>\[] |
@@ -1,6 +1,9 @@
1
1
  # Type Alias: ExecutionContext
2
2
 
3
3
  ```ts
4
- type ExecutionContext = ServiceContextState | CallerContext;
4
+ type ExecutionContext =
5
+ | ServiceContextState
6
+ | CallerContext
7
+ | UserContext;
5
8
 
6
9
  ```
@@ -7,6 +7,7 @@ type ExecutionResult<T> =
7
7
  ok: true;
8
8
  }
9
9
  | {
10
+ error?: IdentityExpiredError;
10
11
  message: string;
11
12
  ok: false;
12
13
  status: number;
@@ -34,3 +35,67 @@ In production, error messages from non-AppKitError sources are handled as:
34
35
  | Type Parameter |
35
36
  | -------------- |
36
37
  | `T` |
38
+
39
+ ## Type Declaration[​](#type-declaration "Direct link to Type Declaration")
40
+
41
+ ```ts
42
+ {
43
+ data: T;
44
+ ok: true;
45
+ }
46
+
47
+ ```
48
+
49
+ ### data[​](#data "Direct link to data")
50
+
51
+ ```ts
52
+ data: T;
53
+
54
+ ```
55
+
56
+ ### ok[​](#ok "Direct link to ok")
57
+
58
+ ```ts
59
+ ok: true;
60
+
61
+ ```
62
+
63
+ ```ts
64
+ {
65
+ error?: IdentityExpiredError;
66
+ message: string;
67
+ ok: false;
68
+ status: number;
69
+ }
70
+
71
+ ```
72
+
73
+ ### error?[​](#error "Direct link to error?")
74
+
75
+ ```ts
76
+ optional error: IdentityExpiredError;
77
+
78
+ ```
79
+
80
+ Typed credential expiry without changing the existing failure envelope.
81
+
82
+ ### message[​](#message "Direct link to message")
83
+
84
+ ```ts
85
+ message: string;
86
+
87
+ ```
88
+
89
+ ### ok[​](#ok-1 "Direct link to ok")
90
+
91
+ ```ts
92
+ ok: false;
93
+
94
+ ```
95
+
96
+ ### status[​](#status "Direct link to status")
97
+
98
+ ```ts
99
+ status: number;
100
+
101
+ ```
@@ -0,0 +1,12 @@
1
+ # Type Alias: ScopedPluginMap\<U>
2
+
3
+ ```ts
4
+ type ScopedPluginMap<U> = { [P in U[number] as P["name"]]: ScopedExports<PluginExports<InstanceType<P["plugin"]>>> };
5
+
6
+ ```
7
+
8
+ ## Type Parameters[​](#type-parameters "Direct link to Type Parameters")
9
+
10
+ | Type Parameter |
11
+ | ----------------------------------------------------------------------------------------------------------------------------------- |
12
+ | `U` *extends* readonly [`PluginData`](./docs/api/appkit/TypeAlias.PluginData.md)<`PluginConstructor`, `unknown`, `string`>\[] |
@@ -0,0 +1,109 @@
1
+ # ~~Type Alias: UserContext~~
2
+
3
+ ```ts
4
+ type UserContext = {
5
+ client: ServiceContextState["client"];
6
+ isUserContext: true;
7
+ tokenFingerprint?: string;
8
+ userEmail?: string;
9
+ userId: string;
10
+ userName?: string;
11
+ warehouseId?: Promise<string>;
12
+ workspaceId: Promise<string>;
13
+ };
14
+
15
+ ```
16
+
17
+ ## Deprecated[​](#deprecated "Direct link to Deprecated")
18
+
19
+ Use CallerContext and its principal field. Kept for callers that construct the legacy shape or read its flat identity fields.
20
+
21
+ ## Properties[​](#properties "Direct link to Properties")
22
+
23
+ ### ~~client~~[​](#client "Direct link to client")
24
+
25
+ ```ts
26
+ client: ServiceContextState["client"];
27
+
28
+ ```
29
+
30
+ WorkspaceClient authenticated as the user
31
+
32
+ ***
33
+
34
+ ### ~~isUserContext~~[​](#isusercontext "Direct link to isusercontext")
35
+
36
+ ```ts
37
+ isUserContext: true;
38
+
39
+ ```
40
+
41
+ Flag indicating this is a user context
42
+
43
+ ***
44
+
45
+ ### ~~tokenFingerprint?~~[​](#tokenfingerprint "Direct link to tokenfingerprint")
46
+
47
+ ```ts
48
+ optional tokenFingerprint: string;
49
+
50
+ ```
51
+
52
+ Truncated SHA-256 hash of the user's OBO token, used to detect token rotation
53
+
54
+ ***
55
+
56
+ ### ~~userEmail?~~[​](#useremail "Direct link to useremail")
57
+
58
+ ```ts
59
+ optional userEmail: string;
60
+
61
+ ```
62
+
63
+ The user's email (from `x-forwarded-email` header)
64
+
65
+ ***
66
+
67
+ ### ~~userId~~[​](#userid "Direct link to userid")
68
+
69
+ ```ts
70
+ userId: string;
71
+
72
+ ```
73
+
74
+ The user's ID (from request headers)
75
+
76
+ ***
77
+
78
+ ### ~~userName?~~[​](#username "Direct link to username")
79
+
80
+ ```ts
81
+ optional userName: string;
82
+
83
+ ```
84
+
85
+ The user's name (from request headers)
86
+
87
+ ***
88
+
89
+ ### ~~warehouseId?~~[​](#warehouseid "Direct link to warehouseid")
90
+
91
+ ```ts
92
+ optional warehouseId: Promise<string>;
93
+
94
+ ```
95
+
96
+ #### Deprecated[​](#deprecated-1 "Direct link to Deprecated")
97
+
98
+ Use getWarehouseId() from @databricks/appkit.
99
+
100
+ ***
101
+
102
+ ### ~~workspaceId~~[​](#workspaceid "Direct link to workspaceid")
103
+
104
+ ```ts
105
+ workspaceId: Promise<string>;
106
+
107
+ ```
108
+
109
+ Promise that resolves to the workspace ID (inherited from service context)
@@ -0,0 +1,39 @@
1
+ # Type Alias: UserScopedApp\<U>
2
+
3
+ ```ts
4
+ type UserScopedApp<U> = ScopedPluginMap<U> & {
5
+ run: Promise<T>;
6
+ };
7
+
8
+ ```
9
+
10
+ ## Type Declaration[​](#type-declaration "Direct link to Type Declaration")
11
+
12
+ ### run()[​](#run "Direct link to run()")
13
+
14
+ ```ts
15
+ run<T>(fn: (kit: ScopedPluginMap<U>) => T | Promise<T>): Promise<T>;
16
+
17
+ ```
18
+
19
+ #### Type Parameters[​](#type-parameters "Direct link to Type Parameters")
20
+
21
+ | Type Parameter |
22
+ | -------------- |
23
+ | `T` |
24
+
25
+ #### Parameters[​](#parameters "Direct link to Parameters")
26
+
27
+ | Parameter | Type |
28
+ | --------- | ---------------------------------------------------------------------------------------------------------------- |
29
+ | `fn` | (`kit`: [`ScopedPluginMap`](./docs/api/appkit/TypeAlias.ScopedPluginMap.md)<`U`>) => `T` \| `Promise`<`T`> |
30
+
31
+ #### Returns[​](#returns "Direct link to Returns")
32
+
33
+ `Promise`<`T`>
34
+
35
+ ## Type Parameters[​](#type-parameters-1 "Direct link to Type Parameters")
36
+
37
+ | Type Parameter |
38
+ | ----------------------------------------------------------------------------------------------------------------------------------- |
39
+ | `U` *extends* readonly [`PluginData`](./docs/api/appkit/TypeAlias.PluginData.md)<`PluginConstructor`, `unknown`, `string`>\[] |