@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
@@ -54,7 +54,7 @@ protected readonly optional _clientMessage: string;
54
54
 
55
55
  ```
56
56
 
57
- Client-safe error message. When set, callers serializing the error to a client (SSE, HTTP body) MUST prefer `clientMessage` over `message` — `message` may contain raw upstream / SDK text including statement fragments, internal object names, and correlation IDs.
57
+ Client-safe error message. When set, callers serializing the error to a client (SSE, HTTP body) MUST prefer `clientMessage` over `message`. `message` may contain raw upstream / SDK text including statement fragments, internal object names, and correlation IDs.
58
58
 
59
59
  Subclasses can set this in their constructor for a fixed sanitized string. When unset, `clientMessage` defaults to a generic per-code string (see the getter), and the raw `message` is kept server-side only.
60
60
 
@@ -54,7 +54,7 @@ protected readonly optional _clientMessage: string;
54
54
 
55
55
  ```
56
56
 
57
- Client-safe error message. When set, callers serializing the error to a client (SSE, HTTP body) MUST prefer `clientMessage` over `message` — `message` may contain raw upstream / SDK text including statement fragments, internal object names, and correlation IDs.
57
+ Client-safe error message. When set, callers serializing the error to a client (SSE, HTTP body) MUST prefer `clientMessage` over `message`. `message` may contain raw upstream / SDK text including statement fragments, internal object names, and correlation IDs.
58
58
 
59
59
  Subclasses can set this in their constructor for a fixed sanitized string. When unset, `clientMessage` defaults to a generic per-code string (see the getter), and the raw `message` is kept server-side only.
60
60
 
@@ -54,7 +54,7 @@ protected readonly optional _clientMessage: string;
54
54
 
55
55
  ```
56
56
 
57
- Client-safe error message. When set, callers serializing the error to a client (SSE, HTTP body) MUST prefer `clientMessage` over `message` — `message` may contain raw upstream / SDK text including statement fragments, internal object names, and correlation IDs.
57
+ Client-safe error message. When set, callers serializing the error to a client (SSE, HTTP body) MUST prefer `clientMessage` over `message`. `message` may contain raw upstream / SDK text including statement fragments, internal object names, and correlation IDs.
58
58
 
59
59
  Subclasses can set this in their constructor for a fixed sanitized string. When unset, `clientMessage` defaults to a generic per-code string (see the getter), and the raw `message` is kept server-side only.
60
60
 
@@ -39,7 +39,7 @@ protected readonly optional _clientMessage: string;
39
39
 
40
40
  ```
41
41
 
42
- Client-safe error message. When set, callers serializing the error to a client (SSE, HTTP body) MUST prefer `clientMessage` over `message` — `message` may contain raw upstream / SDK text including statement fragments, internal object names, and correlation IDs.
42
+ Client-safe error message. When set, callers serializing the error to a client (SSE, HTTP body) MUST prefer `clientMessage` over `message`. `message` may contain raw upstream / SDK text including statement fragments, internal object names, and correlation IDs.
43
43
 
44
44
  Subclasses can set this in their constructor for a fixed sanitized string. When unset, `clientMessage` defaults to a generic per-code string (see the getter), and the raw `message` is kept server-side only.
45
45
 
@@ -56,7 +56,7 @@ protected readonly optional _clientMessage: string;
56
56
 
57
57
  ```
58
58
 
59
- Client-safe error message. When set, callers serializing the error to a client (SSE, HTTP body) MUST prefer `clientMessage` over `message` — `message` may contain raw upstream / SDK text including statement fragments, internal object names, and correlation IDs.
59
+ Client-safe error message. When set, callers serializing the error to a client (SSE, HTTP body) MUST prefer `clientMessage` over `message`. `message` may contain raw upstream / SDK text including statement fragments, internal object names, and correlation IDs.
60
60
 
61
61
  Subclasses can set this in their constructor for a fixed sanitized string. When unset, `clientMessage` defaults to a generic per-code string (see the getter), and the raw `message` is kept server-side only.
62
62
 
@@ -0,0 +1,190 @@
1
+ # Class: IdentityExpiredError
2
+
3
+ The downstream service rejected the active caller's credentials.
4
+
5
+ ## Extends[​](#extends "Direct link to Extends")
6
+
7
+ * [`AppKitError`](./docs/api/appkit/Class.AppKitError.md)
8
+
9
+ ## Constructors[​](#constructors "Direct link to Constructors")
10
+
11
+ ### Constructor[​](#constructor "Direct link to Constructor")
12
+
13
+ ```ts
14
+ new IdentityExpiredError(tokenFingerprint?: string): IdentityExpiredError;
15
+
16
+ ```
17
+
18
+ #### Parameters[​](#parameters "Direct link to Parameters")
19
+
20
+ | Parameter | Type |
21
+ | ------------------- | -------- |
22
+ | `tokenFingerprint?` | `string` |
23
+
24
+ #### Returns[​](#returns "Direct link to Returns")
25
+
26
+ `IdentityExpiredError`
27
+
28
+ #### Overrides[​](#overrides "Direct link to Overrides")
29
+
30
+ [`AppKitError`](./docs/api/appkit/Class.AppKitError.md).[`constructor`](./docs/api/appkit/Class.AppKitError.md#constructor)
31
+
32
+ ## Properties[​](#properties "Direct link to Properties")
33
+
34
+ ### \_clientMessage?[​](#_clientmessage "Direct link to _clientMessage?")
35
+
36
+ ```ts
37
+ protected readonly optional _clientMessage: string;
38
+
39
+ ```
40
+
41
+ Client-safe error message. When set, callers serializing the error to a client (SSE, HTTP body) MUST prefer `clientMessage` over `message`. `message` may contain raw upstream / SDK text including statement fragments, internal object names, and correlation IDs.
42
+
43
+ Subclasses can set this in their constructor for a fixed sanitized string. When unset, `clientMessage` defaults to a generic per-code string (see the getter), and the raw `message` is kept server-side only.
44
+
45
+ #### Inherited from[​](#inherited-from "Direct link to Inherited from")
46
+
47
+ [`AppKitError`](./docs/api/appkit/Class.AppKitError.md).[`_clientMessage`](./docs/api/appkit/Class.AppKitError.md#_clientmessage)
48
+
49
+ ***
50
+
51
+ ### cause?[​](#cause "Direct link to cause?")
52
+
53
+ ```ts
54
+ readonly optional cause: Error;
55
+
56
+ ```
57
+
58
+ Optional cause of the error
59
+
60
+ #### Inherited from[​](#inherited-from-1 "Direct link to Inherited from")
61
+
62
+ [`AppKitError`](./docs/api/appkit/Class.AppKitError.md).[`cause`](./docs/api/appkit/Class.AppKitError.md#cause)
63
+
64
+ ***
65
+
66
+ ### code[​](#code "Direct link to code")
67
+
68
+ ```ts
69
+ readonly code: "IDENTITY_EXPIRED" = "IDENTITY_EXPIRED";
70
+
71
+ ```
72
+
73
+ Error code for programmatic error handling
74
+
75
+ #### Overrides[​](#overrides-1 "Direct link to Overrides")
76
+
77
+ [`AppKitError`](./docs/api/appkit/Class.AppKitError.md).[`code`](./docs/api/appkit/Class.AppKitError.md#code)
78
+
79
+ ***
80
+
81
+ ### context?[​](#context "Direct link to context?")
82
+
83
+ ```ts
84
+ readonly optional context: Record<string, unknown>;
85
+
86
+ ```
87
+
88
+ Additional context for the error
89
+
90
+ #### Inherited from[​](#inherited-from-2 "Direct link to Inherited from")
91
+
92
+ [`AppKitError`](./docs/api/appkit/Class.AppKitError.md).[`context`](./docs/api/appkit/Class.AppKitError.md#context)
93
+
94
+ ***
95
+
96
+ ### isRetryable[​](#isretryable "Direct link to isRetryable")
97
+
98
+ ```ts
99
+ readonly isRetryable: false = false;
100
+
101
+ ```
102
+
103
+ Whether this error type is generally safe to retry
104
+
105
+ #### Overrides[​](#overrides-2 "Direct link to Overrides")
106
+
107
+ [`AppKitError`](./docs/api/appkit/Class.AppKitError.md).[`isRetryable`](./docs/api/appkit/Class.AppKitError.md#isretryable)
108
+
109
+ ***
110
+
111
+ ### statusCode[​](#statuscode "Direct link to statusCode")
112
+
113
+ ```ts
114
+ readonly statusCode: 401 = 401;
115
+
116
+ ```
117
+
118
+ HTTP status code suggestion (can be overridden)
119
+
120
+ #### Overrides[​](#overrides-3 "Direct link to Overrides")
121
+
122
+ [`AppKitError`](./docs/api/appkit/Class.AppKitError.md).[`statusCode`](./docs/api/appkit/Class.AppKitError.md#statuscode)
123
+
124
+ ***
125
+
126
+ ### tokenFingerprint?[​](#tokenfingerprint "Direct link to tokenFingerprint?")
127
+
128
+ ```ts
129
+ readonly optional tokenFingerprint: string;
130
+
131
+ ```
132
+
133
+ ## Accessors[​](#accessors "Direct link to Accessors")
134
+
135
+ ### clientMessage[​](#clientmessage "Direct link to clientMessage")
136
+
137
+ #### Get Signature[​](#get-signature "Direct link to Get Signature")
138
+
139
+ ```ts
140
+ get clientMessage(): string;
141
+
142
+ ```
143
+
144
+ Sanitized message safe to forward to clients. Override in subclasses if a more specific default is appropriate.
145
+
146
+ ##### Returns[​](#returns-1 "Direct link to Returns")
147
+
148
+ `string`
149
+
150
+ #### Inherited from[​](#inherited-from-3 "Direct link to Inherited from")
151
+
152
+ [`AppKitError`](./docs/api/appkit/Class.AppKitError.md).[`clientMessage`](./docs/api/appkit/Class.AppKitError.md#clientmessage)
153
+
154
+ ## Methods[​](#methods "Direct link to Methods")
155
+
156
+ ### toJSON()[​](#tojson "Direct link to toJSON()")
157
+
158
+ ```ts
159
+ toJSON(): Record<string, unknown>;
160
+
161
+ ```
162
+
163
+ Convert error to JSON for logging/serialization. Sensitive values in context are automatically redacted.
164
+
165
+ #### Returns[​](#returns-2 "Direct link to Returns")
166
+
167
+ `Record`<`string`, `unknown`>
168
+
169
+ #### Inherited from[​](#inherited-from-4 "Direct link to Inherited from")
170
+
171
+ [`AppKitError`](./docs/api/appkit/Class.AppKitError.md).[`toJSON`](./docs/api/appkit/Class.AppKitError.md#tojson)
172
+
173
+ ***
174
+
175
+ ### toString()[​](#tostring "Direct link to toString()")
176
+
177
+ ```ts
178
+ toString(): string;
179
+
180
+ ```
181
+
182
+ Create a human-readable string representation
183
+
184
+ #### Returns[​](#returns-3 "Direct link to Returns")
185
+
186
+ `string`
187
+
188
+ #### Inherited from[​](#inherited-from-5 "Direct link to Inherited from")
189
+
190
+ [`AppKitError`](./docs/api/appkit/Class.AppKitError.md).[`toString`](./docs/api/appkit/Class.AppKitError.md#tostring)
@@ -54,7 +54,7 @@ protected readonly optional _clientMessage: string;
54
54
 
55
55
  ```
56
56
 
57
- Client-safe error message. When set, callers serializing the error to a client (SSE, HTTP body) MUST prefer `clientMessage` over `message` — `message` may contain raw upstream / SDK text including statement fragments, internal object names, and correlation IDs.
57
+ Client-safe error message. When set, callers serializing the error to a client (SSE, HTTP body) MUST prefer `clientMessage` over `message`. `message` may contain raw upstream / SDK text including statement fragments, internal object names, and correlation IDs.
58
58
 
59
59
  Subclasses can set this in their constructor for a fixed sanitized string. When unset, `clientMessage` defaults to a generic per-code string (see the getter), and the raw `message` is kept server-side only.
60
60
 
@@ -239,30 +239,26 @@ BasePlugin.abortActiveOperations
239
239
 
240
240
  ***
241
241
 
242
- ### asUser()[​](#asuser "Direct link to asUser()")
242
+ ### ~~asUser()~~[​](#asuser "Direct link to asuser")
243
243
 
244
244
  ```ts
245
245
  asUser(req: Request): this;
246
246
 
247
247
  ```
248
248
 
249
- Execute operations using the user's identity from the request. Returns a proxy of this plugin where all method calls execute with the user's Databricks credentials instead of the service principal.
250
-
251
249
  #### Parameters[​](#parameters-1 "Direct link to Parameters")
252
250
 
253
- | Parameter | Type | Description |
254
- | --------- | --------- | -------------------------------------------------------- |
255
- | `req` | `Request` | The Express request containing the user token in headers |
251
+ | Parameter | Type |
252
+ | --------- | --------- |
253
+ | `req` | `Request` |
256
254
 
257
255
  #### Returns[​](#returns-2 "Direct link to Returns")
258
256
 
259
257
  `this`
260
258
 
261
- A proxied plugin instance that executes as the user
259
+ #### Deprecated[​](#deprecated "Direct link to Deprecated")
262
260
 
263
- #### Throws[​](#throws "Direct link to Throws")
264
-
265
- AuthenticationError if user token is not available in request headers (production only). In development mode (`NODE_ENV=development`), skips user impersonation instead of throwing.
261
+ Use appkit.asUser(req) to scope the whole app.
266
262
 
267
263
  ***
268
264
 
@@ -374,7 +370,7 @@ Returns an [ExecutionResult](./docs/api/appkit/TypeAlias.ExecutionResult.md) dis
374
370
  * `{ ok: true, data: T }` on success
375
371
  * `{ ok: false, status: number, message: string }` on failure
376
372
 
377
- Errors are never thrown — the method is production-safe.
373
+ Caller credential expiration retains the failure result and additionally exposes a typed error, preserving existing result-based callers.
378
374
 
379
375
  #### Type Parameters[​](#type-parameters-1 "Direct link to Type Parameters")
380
376
 
@@ -576,7 +572,7 @@ Returns the `x-forwarded-user` header when present. In development mode (`NODE_E
576
572
 
577
573
  `string`
578
574
 
579
- #### Throws[​](#throws-1 "Direct link to Throws")
575
+ #### Throws[​](#throws "Direct link to Throws")
580
576
 
581
577
  AuthenticationError in production when no user header is present.
582
578
 
@@ -53,7 +53,7 @@ protected readonly optional _clientMessage: string;
53
53
 
54
54
  ```
55
55
 
56
- Client-safe error message. When set, callers serializing the error to a client (SSE, HTTP body) MUST prefer `clientMessage` over `message` — `message` may contain raw upstream / SDK text including statement fragments, internal object names, and correlation IDs.
56
+ Client-safe error message. When set, callers serializing the error to a client (SSE, HTTP body) MUST prefer `clientMessage` over `message`. `message` may contain raw upstream / SDK text including statement fragments, internal object names, and correlation IDs.
57
57
 
58
58
  Subclasses can set this in their constructor for a fixed sanitized string. When unset, `clientMessage` defaults to a generic per-code string (see the getter), and the raw `message` is kept server-side only.
59
59
 
@@ -0,0 +1,169 @@
1
+ # Class: ServiceContext
2
+
3
+ ServiceContext is a singleton that manages the service principal's WorkspaceClient and workspace ID. WarehouseResource owns warehouse bindings.
4
+
5
+ It's initialized once at app startup and provides the foundation for both service principal and user context execution.
6
+
7
+ ## Constructors[​](#constructors "Direct link to Constructors")
8
+
9
+ ### Constructor[​](#constructor "Direct link to Constructor")
10
+
11
+ ```ts
12
+ new ServiceContext(): ServiceContext;
13
+
14
+ ```
15
+
16
+ #### Returns[​](#returns "Direct link to Returns")
17
+
18
+ `ServiceContext`
19
+
20
+ ## Methods[​](#methods "Direct link to Methods")
21
+
22
+ ### createCallerContext()[​](#createcallercontext "Direct link to createCallerContext()")
23
+
24
+ ```ts
25
+ static createCallerContext(
26
+ token: string,
27
+ userId: string,
28
+ userName?: string,
29
+ userEmail?: string): CallerContext;
30
+
31
+ ```
32
+
33
+ Create an immutable caller context from the existing user request headers.
34
+
35
+ #### Parameters[​](#parameters "Direct link to Parameters")
36
+
37
+ | Parameter | Type | Description |
38
+ | ------------ | -------- | ------------------------------------------------------------ |
39
+ | `token` | `string` | The user's access token from x-forwarded-access-token header |
40
+ | `userId` | `string` | The user's ID from x-forwarded-user header |
41
+ | `userName?` | `string` | Optional user name |
42
+ | `userEmail?` | `string` | Optional email from x-forwarded-email |
43
+
44
+ #### Returns[​](#returns-1 "Direct link to Returns")
45
+
46
+ [`CallerContext`](./docs/api/appkit/Interface.CallerContext.md)
47
+
48
+ #### Throws[​](#throws "Direct link to Throws")
49
+
50
+ Error if token is not provided
51
+
52
+ ***
53
+
54
+ ### ~~createUserContext()~~[​](#createusercontext "Direct link to createusercontext")
55
+
56
+ ```ts
57
+ static createUserContext(
58
+ token: string,
59
+ userId: string,
60
+ userName?: string,
61
+ userEmail?: string): CallerContext & UserContext;
62
+
63
+ ```
64
+
65
+ #### Parameters[​](#parameters-1 "Direct link to Parameters")
66
+
67
+ | Parameter | Type |
68
+ | ------------ | -------- |
69
+ | `token` | `string` |
70
+ | `userId` | `string` |
71
+ | `userName?` | `string` |
72
+ | `userEmail?` | `string` |
73
+
74
+ #### Returns[​](#returns-2 "Direct link to Returns")
75
+
76
+ [`CallerContext`](./docs/api/appkit/Interface.CallerContext.md) & [`UserContext`](./docs/api/appkit/TypeAlias.UserContext.md)
77
+
78
+ #### Deprecated[​](#deprecated "Direct link to Deprecated")
79
+
80
+ Use ServiceContext.createCallerContext.
81
+
82
+ ***
83
+
84
+ ### get()[​](#get "Direct link to get()")
85
+
86
+ ```ts
87
+ static get(): ServiceContextState;
88
+
89
+ ```
90
+
91
+ Get the initialized service context.
92
+
93
+ #### Returns[​](#returns-3 "Direct link to Returns")
94
+
95
+ `ServiceContextState`
96
+
97
+ #### Throws[​](#throws-1 "Direct link to Throws")
98
+
99
+ Error if not initialized
100
+
101
+ ***
102
+
103
+ ### getClientOptions()[​](#getclientoptions "Direct link to getClientOptions()")
104
+
105
+ ```ts
106
+ static getClientOptions(): ClientOptions;
107
+
108
+ ```
109
+
110
+ Get the client options for WorkspaceClient. Exposed for testing purposes.
111
+
112
+ #### Returns[​](#returns-4 "Direct link to Returns")
113
+
114
+ `ClientOptions`
115
+
116
+ ***
117
+
118
+ ### initialize()[​](#initialize "Direct link to initialize()")
119
+
120
+ ```ts
121
+ static initialize(options?: {
122
+ warehouseId?: string | boolean;
123
+ }, client?: WorkspaceClient): Promise<ServiceContextState>;
124
+
125
+ ```
126
+
127
+ Initialize the service context. Should be called once at app startup. Safe to call multiple times - will return the same instance.
128
+
129
+ #### Parameters[​](#parameters-2 "Direct link to Parameters")
130
+
131
+ | Parameter | Type | Description |
132
+ | ---------------------- | ------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
133
+ | `options?` | { `warehouseId?`: `string` \| `boolean`; } | A resolved warehouse ID, or a boolean enabling discovery. |
134
+ | `options.warehouseId?` | `string` \| `boolean` | - |
135
+ | `client?` | [`WorkspaceClient`](./docs/api/appkit/Interface.WorkspaceClient.md) | Optional pre-configured WorkspaceClient to use instead of creating one from environment credentials. |
136
+
137
+ #### Returns[​](#returns-5 "Direct link to Returns")
138
+
139
+ `Promise`<`ServiceContextState`>
140
+
141
+ ***
142
+
143
+ ### isInitialized()[​](#isinitialized "Direct link to isInitialized()")
144
+
145
+ ```ts
146
+ static isInitialized(): boolean;
147
+
148
+ ```
149
+
150
+ Check if the service context has been initialized.
151
+
152
+ #### Returns[​](#returns-6 "Direct link to Returns")
153
+
154
+ `boolean`
155
+
156
+ ***
157
+
158
+ ### reset()[​](#reset "Direct link to reset()")
159
+
160
+ ```ts
161
+ static reset(): void;
162
+
163
+ ```
164
+
165
+ Reset the service context. Only for testing purposes.
166
+
167
+ #### Returns[​](#returns-7 "Direct link to Returns")
168
+
169
+ `void`
@@ -54,7 +54,7 @@ protected readonly optional _clientMessage: string;
54
54
 
55
55
  ```
56
56
 
57
- Client-safe error message. When set, callers serializing the error to a client (SSE, HTTP body) MUST prefer `clientMessage` over `message` — `message` may contain raw upstream / SDK text including statement fragments, internal object names, and correlation IDs.
57
+ Client-safe error message. When set, callers serializing the error to a client (SSE, HTTP body) MUST prefer `clientMessage` over `message`. `message` may contain raw upstream / SDK text including statement fragments, internal object names, and correlation IDs.
58
58
 
59
59
  Subclasses can set this in their constructor for a fixed sanitized string. When unset, `clientMessage` defaults to a generic per-code string (see the getter), and the raw `message` is kept server-side only.
60
60
 
@@ -54,7 +54,7 @@ protected readonly optional _clientMessage: string;
54
54
 
55
55
  ```
56
56
 
57
- Client-safe error message. When set, callers serializing the error to a client (SSE, HTTP body) MUST prefer `clientMessage` over `message` — `message` may contain raw upstream / SDK text including statement fragments, internal object names, and correlation IDs.
57
+ Client-safe error message. When set, callers serializing the error to a client (SSE, HTTP body) MUST prefer `clientMessage` over `message`. `message` may contain raw upstream / SDK text including statement fragments, internal object names, and correlation IDs.
58
58
 
59
59
  Subclasses can set this in their constructor for a fixed sanitized string. When unset, `clientMessage` defaults to a generic per-code string (see the getter), and the raw `message` is kept server-side only.
60
60
 
@@ -5,10 +5,10 @@ function createApp<T>(config: {
5
5
  cache?: CacheConfig;
6
6
  client?: WorkspaceClient;
7
7
  disableInternalTelemetry?: boolean;
8
- onPluginsReady?: (appkit: PluginMap<T>) => void | Promise<void>;
8
+ onPluginsReady?: (appkit: AppKitApi<T>) => void | Promise<void>;
9
9
  plugins?: T;
10
10
  telemetry?: TelemetryConfig;
11
- }): Promise<PluginMap<T>>;
11
+ }): Promise<AppKitApi<T>>;
12
12
 
13
13
  ```
14
14
 
@@ -24,19 +24,19 @@ Initializes telemetry, cache, and service context, then registers plugins in pha
24
24
 
25
25
  ## Parameters[​](#parameters "Direct link to Parameters")
26
26
 
27
- | Parameter | Type | Description |
28
- | ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- |
29
- | `config` | { `cache?`: [`CacheConfig`](./docs/api/appkit/Interface.CacheConfig.md); `client?`: [`WorkspaceClient`](./docs/api/appkit/Interface.WorkspaceClient.md); `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`](./docs/api/appkit/Interface.WorkspaceClient.md) | - |
32
- | `config.disableInternalTelemetry?` | `boolean` | - |
33
- | `config.onPluginsReady?` | (`appkit`: `PluginMap`<`T`>) => `void` \| `Promise`<`void`> | Runs after plugin setup but **before** the server starts. |
34
- | `config.plugins?` | `T` | - |
35
- | `config.telemetry?` | [`TelemetryConfig`](./docs/api/appkit/Interface.TelemetryConfig.md) | - |
27
+ | Parameter | Type | Description |
28
+ | ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- |
29
+ | `config` | { `cache?`: [`CacheConfig`](./docs/api/appkit/Interface.CacheConfig.md); `client?`: [`WorkspaceClient`](./docs/api/appkit/Interface.WorkspaceClient.md); `disableInternalTelemetry?`: `boolean`; `onPluginsReady?`: (`appkit`: [`AppKitApi`](./docs/api/appkit/TypeAlias.AppKitApi.md)<`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`](./docs/api/appkit/Interface.WorkspaceClient.md) | - |
32
+ | `config.disableInternalTelemetry?` | `boolean` | - |
33
+ | `config.onPluginsReady?` | (`appkit`: [`AppKitApi`](./docs/api/appkit/TypeAlias.AppKitApi.md)<`T`>) => `void` \| `Promise`<`void`> | Runs after plugin setup but **before** the server starts. |
34
+ | `config.plugins?` | `T` | - |
35
+ | `config.telemetry?` | [`TelemetryConfig`](./docs/api/appkit/Interface.TelemetryConfig.md) | - |
36
36
 
37
37
  ## Returns[​](#returns "Direct link to Returns")
38
38
 
39
- `Promise`<`PluginMap`<`T`>>
39
+ `Promise`<[`AppKitApi`](./docs/api/appkit/TypeAlias.AppKitApi.md)<`T`>>
40
40
 
41
41
  A `PluginMap` keyed by plugin name with typed exports
42
42
 
@@ -0,0 +1,12 @@
1
+ # Function: getCallerContext()
2
+
3
+ ```ts
4
+ function getCallerContext(): CallerContext | undefined;
5
+
6
+ ```
7
+
8
+ Get the caller context if one is active, otherwise `undefined`. Unlike `getExecutionContext()`, this does not require `ServiceContext` to be initialized and never throws.
9
+
10
+ ## Returns[​](#returns "Direct link to Returns")
11
+
12
+ [`CallerContext`](./docs/api/appkit/Interface.CallerContext.md) | `undefined`
@@ -0,0 +1,14 @@
1
+ # ~~Function: getCurrentUserId()~~
2
+
3
+ ```ts
4
+ function getCurrentUserId(): string;
5
+
6
+ ```
7
+
8
+ ## Returns[​](#returns "Direct link to Returns")
9
+
10
+ `string`
11
+
12
+ ## Deprecated[​](#deprecated "Direct link to Deprecated")
13
+
14
+ Use getCurrentPrincipalKey for new cache keys or getCurrentActorId for audit. Preserves the bare user or service ID for existing callers.
@@ -14,7 +14,7 @@ Get the current execution context.
14
14
 
15
15
  ## Returns[​](#returns "Direct link to Returns")
16
16
 
17
- \| `ServiceContextState` | [`CallerContext`](./docs/api/appkit/Interface.CallerContext.md) & `UserContext`
17
+ \| `ServiceContextState` | [`CallerContext`](./docs/api/appkit/Interface.CallerContext.md) & [`UserContext`](./docs/api/appkit/TypeAlias.UserContext.md)
18
18
 
19
19
  ## Throws[​](#throws "Direct link to Throws")
20
20
 
@@ -0,0 +1,16 @@
1
+ # ~~Function: getUserContext()~~
2
+
3
+ ```ts
4
+ function getUserContext():
5
+ | CallerContext & UserContext
6
+ | undefined;
7
+
8
+ ```
9
+
10
+ ## Returns[​](#returns "Direct link to Returns")
11
+
12
+ \| [`CallerContext`](./docs/api/appkit/Interface.CallerContext.md) & [`UserContext`](./docs/api/appkit/TypeAlias.UserContext.md) | `undefined`
13
+
14
+ ## Deprecated[​](#deprecated "Direct link to Deprecated")
15
+
16
+ Use getCallerContext and its principal field.
@@ -0,0 +1,12 @@
1
+ # Function: isInUserContext()
2
+
3
+ ```ts
4
+ function isInUserContext(): boolean;
5
+
6
+ ```
7
+
8
+ Check if currently running in a user context.
9
+
10
+ ## Returns[​](#returns "Direct link to Returns")
11
+
12
+ `boolean`
@@ -0,0 +1,20 @@
1
+ # ~~Function: isUserContext()~~
2
+
3
+ ```ts
4
+ function isUserContext(ctx: ExecutionContext): ctx is UserContext & Partial<CallerContext>;
5
+
6
+ ```
7
+
8
+ ## Parameters[​](#parameters "Direct link to Parameters")
9
+
10
+ | Parameter | Type |
11
+ | --------- | --------------------------------------------------------------------------- |
12
+ | `ctx` | [`ExecutionContext`](./docs/api/appkit/TypeAlias.ExecutionContext.md) |
13
+
14
+ ## Returns[​](#returns "Direct link to Returns")
15
+
16
+ `ctx is UserContext & Partial<CallerContext>`
17
+
18
+ ## Deprecated[​](#deprecated "Direct link to Deprecated")
19
+
20
+ Use isCallerContext. Active caller contexts retain the legacy identity accessors for callers narrowed by this guard.