@databricks/appkit-ui 0.88.1 → 0.89.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 (136) hide show
  1. package/CLAUDE.md +7 -2
  2. package/dist/cli/commands/doctor/checks-existence.js +16 -16
  3. package/dist/cli/commands/doctor/checks-existence.js.map +1 -1
  4. package/dist/cli/commands/doctor/checks.js +15 -18
  5. package/dist/cli/commands/doctor/checks.js.map +1 -1
  6. package/dist/cli/commands/doctor/databricks-client.js +8 -6
  7. package/dist/cli/commands/doctor/databricks-client.js.map +1 -1
  8. package/dist/cli/commands/registry/workspace-picker.js +34 -24
  9. package/dist/cli/commands/registry/workspace-picker.js.map +1 -1
  10. package/dist/react/genie/genie-chart-inference.js.map +1 -1
  11. package/dist/react/genie/genie-query-transform.d.ts +5 -2
  12. package/dist/react/genie/genie-query-transform.d.ts.map +1 -1
  13. package/dist/react/genie/genie-query-transform.js +14 -8
  14. package/dist/react/genie/genie-query-transform.js.map +1 -1
  15. package/dist/shared/src/genie.d.ts +9 -3
  16. package/dist/shared/src/genie.d.ts.map +1 -1
  17. package/dist/shared/src/workspace-client/factory.d.ts +0 -1
  18. package/dist/shared/src/workspace-client/index.d.ts +1 -2
  19. package/dist/shared/src/workspace-client/modular.d.ts +19 -0
  20. package/dist/shared/src/workspace-client/types.d.ts +1 -2
  21. package/dist/workspace-client/client.js +81 -23
  22. package/dist/workspace-client/client.js.map +1 -1
  23. package/dist/workspace-client/errors.d.ts +14 -2
  24. package/dist/workspace-client/errors.d.ts.map +1 -0
  25. package/dist/workspace-client/errors.js +45 -2
  26. package/dist/workspace-client/errors.js.map +1 -0
  27. package/dist/workspace-client/factory.d.ts +1 -1
  28. package/dist/workspace-client/factory.js.map +1 -1
  29. package/dist/workspace-client/index.d.ts +4 -3
  30. package/dist/workspace-client/index.js +2 -2
  31. package/dist/workspace-client/modular.d.ts +109 -0
  32. package/dist/workspace-client/modular.d.ts.map +1 -0
  33. package/dist/workspace-client/modular.js +447 -0
  34. package/dist/workspace-client/modular.js.map +1 -0
  35. package/dist/workspace-client/options.d.ts +29 -0
  36. package/dist/workspace-client/options.d.ts.map +1 -0
  37. package/dist/workspace-client/types.d.ts +35 -38
  38. package/dist/workspace-client/types.d.ts.map +1 -1
  39. package/docs/api/appkit/Class.ApiError.md +110 -0
  40. package/docs/api/appkit/Class.DatabricksAdapter.md +2 -2
  41. package/docs/api/appkit/Class.SupervisorApiAdapter.md +1 -1
  42. package/docs/api/appkit/Function.generateDatabaseCredential.md +2 -2
  43. package/docs/api/appkit/Function.getWorkspaceClient.md +2 -2
  44. package/docs/api/appkit/Interface.DirectoryEntry.md +62 -0
  45. package/docs/api/appkit/Interface.DownloadResponse.md +45 -0
  46. package/docs/api/appkit/Interface.JobAPI.md +20 -12
  47. package/docs/api/appkit/Interface.LakebasePoolConfig.md +1 -1
  48. package/docs/api/appkit/Interface.WorkspaceClient.md +168 -26
  49. package/docs/api/appkit/Interface.WorkspaceClientOptions.md +1 -14
  50. package/docs/api/appkit/TypeAlias.FilesDirectoryEntry.md +8 -0
  51. package/docs/api/appkit/TypeAlias.FilesDownloadResponse.md +8 -0
  52. package/docs/api/appkit/TypeAlias.JobsExport.md +1 -1
  53. package/docs/api/appkit/TypeAlias.WorkspaceClientLike.md +16 -0
  54. package/docs/api/appkit.md +7 -2
  55. package/docs/plugins/files.md +20 -3
  56. package/docs/plugins/jobs.md +9 -9
  57. package/docs/plugins/testing.md +10 -8
  58. package/llms.txt +7 -2
  59. package/node_modules/@databricks/sdk-genie/LICENSE +203 -0
  60. package/node_modules/@databricks/sdk-genie/README.md +23 -0
  61. package/node_modules/@databricks/sdk-genie/dist/package.js +7 -0
  62. package/node_modules/@databricks/sdk-genie/dist/package.js.map +1 -0
  63. package/node_modules/@databricks/sdk-genie/dist/v1/client.d.ts +175 -0
  64. package/node_modules/@databricks/sdk-genie/dist/v1/client.d.ts.map +1 -0
  65. package/node_modules/@databricks/sdk-genie/dist/v1/client.js +829 -0
  66. package/node_modules/@databricks/sdk-genie/dist/v1/client.js.map +1 -0
  67. package/node_modules/@databricks/sdk-genie/dist/v1/index.d.ts +3 -0
  68. package/node_modules/@databricks/sdk-genie/dist/v1/index.js +4 -0
  69. package/node_modules/@databricks/sdk-genie/dist/v1/model.d.ts +1799 -0
  70. package/node_modules/@databricks/sdk-genie/dist/v1/model.d.ts.map +1 -0
  71. package/node_modules/@databricks/sdk-genie/dist/v1/model.js +1097 -0
  72. package/node_modules/@databricks/sdk-genie/dist/v1/model.js.map +1 -0
  73. package/node_modules/@databricks/sdk-genie/dist/v1/transport.d.ts +37 -0
  74. package/node_modules/@databricks/sdk-genie/dist/v1/transport.d.ts.map +1 -0
  75. package/node_modules/@databricks/sdk-genie/dist/v1/transport.js +73 -0
  76. package/node_modules/@databricks/sdk-genie/dist/v1/transport.js.map +1 -0
  77. package/node_modules/@databricks/sdk-genie/dist/v1/utils.d.ts +43 -0
  78. package/node_modules/@databricks/sdk-genie/dist/v1/utils.d.ts.map +1 -0
  79. package/node_modules/@databricks/sdk-genie/dist/v1/utils.js +130 -0
  80. package/node_modules/@databricks/sdk-genie/dist/v1/utils.js.map +1 -0
  81. package/node_modules/@databricks/sdk-genie/package.json +46 -0
  82. package/node_modules/@databricks/sdk-statementexecution/LICENSE +203 -0
  83. package/node_modules/@databricks/sdk-statementexecution/README.md +23 -0
  84. package/node_modules/@databricks/sdk-statementexecution/dist/package.js +7 -0
  85. package/node_modules/@databricks/sdk-statementexecution/dist/package.js.map +1 -0
  86. package/node_modules/@databricks/sdk-statementexecution/dist/v1/client.d.ts +91 -0
  87. package/node_modules/@databricks/sdk-statementexecution/dist/v1/client.d.ts.map +1 -0
  88. package/node_modules/@databricks/sdk-statementexecution/dist/v1/client.js +183 -0
  89. package/node_modules/@databricks/sdk-statementexecution/dist/v1/client.js.map +1 -0
  90. package/node_modules/@databricks/sdk-statementexecution/dist/v1/index.d.ts +3 -0
  91. package/node_modules/@databricks/sdk-statementexecution/dist/v1/index.js +4 -0
  92. package/node_modules/@databricks/sdk-statementexecution/dist/v1/model.d.ts +506 -0
  93. package/node_modules/@databricks/sdk-statementexecution/dist/v1/model.d.ts.map +1 -0
  94. package/node_modules/@databricks/sdk-statementexecution/dist/v1/model.js +302 -0
  95. package/node_modules/@databricks/sdk-statementexecution/dist/v1/model.js.map +1 -0
  96. package/node_modules/@databricks/sdk-statementexecution/dist/v1/transport.d.ts +37 -0
  97. package/node_modules/@databricks/sdk-statementexecution/dist/v1/transport.d.ts.map +1 -0
  98. package/node_modules/@databricks/sdk-statementexecution/dist/v1/transport.js +73 -0
  99. package/node_modules/@databricks/sdk-statementexecution/dist/v1/transport.js.map +1 -0
  100. package/node_modules/@databricks/sdk-statementexecution/dist/v1/utils.d.ts +25 -0
  101. package/node_modules/@databricks/sdk-statementexecution/dist/v1/utils.d.ts.map +1 -0
  102. package/node_modules/@databricks/sdk-statementexecution/dist/v1/utils.js +87 -0
  103. package/node_modules/@databricks/sdk-statementexecution/dist/v1/utils.js.map +1 -0
  104. package/node_modules/@databricks/sdk-statementexecution/package.json +46 -0
  105. package/node_modules/@databricks/sdk-vectorsearch/LICENSE +203 -0
  106. package/node_modules/@databricks/sdk-vectorsearch/README.md +23 -0
  107. package/node_modules/@databricks/sdk-vectorsearch/dist/package.js +7 -0
  108. package/node_modules/@databricks/sdk-vectorsearch/dist/package.js.map +1 -0
  109. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/client.d.ts +70 -0
  110. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/client.d.ts.map +1 -0
  111. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/client.js +474 -0
  112. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/client.js.map +1 -0
  113. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/index.d.ts +3 -0
  114. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/index.js +4 -0
  115. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/model.d.ts +704 -0
  116. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/model.d.ts.map +1 -0
  117. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/model.js +635 -0
  118. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/model.js.map +1 -0
  119. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/transport.d.ts +37 -0
  120. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/transport.d.ts.map +1 -0
  121. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/transport.js +73 -0
  122. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/transport.js.map +1 -0
  123. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/utils.d.ts +37 -0
  124. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/utils.d.ts.map +1 -0
  125. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/utils.js +104 -0
  126. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/utils.js.map +1 -0
  127. package/node_modules/@databricks/sdk-vectorsearch/package.json +46 -0
  128. package/package.json +29 -4
  129. package/sbom.cdx.json +1 -1
  130. package/dist/shared/src/workspace-client/errors.d.ts +0 -1
  131. package/dist/shared/src/workspace-client/legacy.d.ts +0 -3
  132. package/dist/workspace-client/legacy.d.ts +0 -34
  133. package/dist/workspace-client/legacy.d.ts.map +0 -1
  134. package/dist/workspace-client/legacy.js +0 -23
  135. package/dist/workspace-client/legacy.js.map +0 -1
  136. package/docs/api/appkit/Interface.WorkspaceClientLike.md +0 -67
@@ -0,0 +1,829 @@
1
+ import { resolveClientConfig } from "./transport.js";
2
+ import { StillRunningError, buildHttpRequest, executeCall, executeHttpCall, executeWait, marshalRequest, parseResponse, sendAndCheckError } from "./utils.js";
3
+ import { name, version } from "../package.js";
4
+ import { MessageStatus_MessageStatus, marshalGenieCancelResponseRequestSchema, marshalGenieCreateConversationMessageRequestSchema, marshalGenieCreateEvalRunRequestSchema, marshalGenieCreateMessageCommentRequestSchema, marshalGenieCreateSpaceRequestSchema, marshalGenieExecuteMessageAttachmentQueryRequestSchema, marshalGenieExecuteMessageQueryRequestSchema, marshalGenieGenerateDownloadFullQueryResultRequestSchema, marshalGenieSendMessageFeedbackRequestSchema, marshalGenieStartConversationRequestSchema, marshalGenieUpdateSpaceRequestSchema, unmarshalGenieEvalResultDetailsSchema, unmarshalGenieEvalRunResponseSchema, unmarshalGenieGenerateDownloadFullQueryResultResponseSchema, unmarshalGenieGetDownloadFullQueryResultResponseSchema, unmarshalGenieGetMessageQueryResultResponseSchema, unmarshalGenieListConversationCommentsResponseSchema, unmarshalGenieListConversationMessagesResponseSchema, unmarshalGenieListConversationsResponseSchema, unmarshalGenieListEvalResultsResponseSchema, unmarshalGenieListEvalRunsResponseSchema, unmarshalGenieListMessageCommentsResponseSchema, unmarshalGenieListSpacesResponseSchema, unmarshalGenieMessageCommentSchema, unmarshalGenieMessageSchema, unmarshalGenieSpaceSchema, unmarshalGenieStartConversationResponseSchema } from "./model.js";
5
+ import { VERSION } from "@databricks/sdk-auth";
6
+ import { createDefault } from "@databricks/sdk-core/clientinfo";
7
+ import { NoOpLogger } from "@databricks/sdk-core/logger";
8
+
9
+ //#region src/v1/client.ts
10
+ const PACKAGE_SEGMENT = {
11
+ key: "sdk-js-" + name.replace(/^@[^/]+\/sdk-/, ""),
12
+ value: version
13
+ };
14
+ var GenieClient = class {
15
+ options;
16
+ logger;
17
+ userAgent;
18
+ config;
19
+ constructor(options) {
20
+ this.options = options;
21
+ this.logger = options.logger ?? new NoOpLogger();
22
+ this.userAgent = createDefault().with(PACKAGE_SEGMENT).with({
23
+ key: "sdk-js-auth",
24
+ value: VERSION
25
+ }).with({
26
+ key: "auth",
27
+ value: options.credentials?.name() ?? "default"
28
+ }).toString();
29
+ }
30
+ resolveConfig() {
31
+ this.config ??= resolveClientConfig(this.options);
32
+ return this.config;
33
+ }
34
+ /** Creates a Genie space from a serialized payload. */
35
+ async createSpace(req, options) {
36
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
37
+ const url = `${host}/api/2.0/genie/spaces`;
38
+ const body = marshalRequest(req, marshalGenieCreateSpaceRequestSchema);
39
+ let resp;
40
+ const call = async (callSignal) => {
41
+ const headers = new Headers({ "Content-Type": "application/json" });
42
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
43
+ headers.set("User-Agent", this.userAgent);
44
+ resp = parseResponse(await executeHttpCall({
45
+ request: buildHttpRequest("POST", url, headers, callSignal, body),
46
+ httpClient,
47
+ logger: this.logger
48
+ }), unmarshalGenieSpaceSchema);
49
+ };
50
+ await executeCall(call, options);
51
+ if (resp === void 0) throw new Error("operation completed without a result.");
52
+ return resp;
53
+ }
54
+ /**
55
+ * Download a rendered image of a message visualization attachment.
56
+ * The response body is the raw PNG image, not a JSON payload.
57
+ * This is only available if the attachment is a visualization and the message status is `COMPLETED`.
58
+ */
59
+ async downloadMessageAttachmentVisualization(req, options) {
60
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
61
+ const url = `${host}/api/2.0/genie/${req.name ?? ""}/download-visualization`;
62
+ let resp;
63
+ const call = async (callSignal) => {
64
+ const headers = new Headers({ Accept: "application/octet-stream" });
65
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
66
+ headers.set("User-Agent", this.userAgent);
67
+ resp = { contents: (await sendAndCheckError({
68
+ request: buildHttpRequest("GET", url, headers, callSignal),
69
+ httpClient,
70
+ logger: this.logger
71
+ })).body ?? void 0 };
72
+ };
73
+ await executeCall(call, options);
74
+ if (resp === void 0) throw new Error("operation completed without a result.");
75
+ return resp;
76
+ }
77
+ /**
78
+ * Cancels an in-flight agent-mode response. `response_id` is the id returned in the
79
+ * `response.created` event from the agent-mode responses endpoint. The response stops at
80
+ * the next agent boundary and its terminal state is returned.
81
+ */
82
+ async genieCancelResponse(req, options) {
83
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
84
+ const url = `${host}/api/2.0/genie/agents/${req.agentId ?? ""}/conversations/${req.conversationId ?? ""}/responses/${req.responseId ?? ""}/cancel`;
85
+ const body = marshalRequest(req, marshalGenieCancelResponseRequestSchema);
86
+ let resp;
87
+ const call = async (callSignal) => {
88
+ const headers = new Headers({ "Content-Type": "application/json" });
89
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
90
+ headers.set("User-Agent", this.userAgent);
91
+ resp = parseResponse(await executeHttpCall({
92
+ request: buildHttpRequest("POST", url, headers, callSignal, body),
93
+ httpClient,
94
+ logger: this.logger
95
+ }), unmarshalGenieMessageSchema);
96
+ };
97
+ await executeCall(call, options);
98
+ if (resp === void 0) throw new Error("operation completed without a result.");
99
+ return resp;
100
+ }
101
+ /**
102
+ * Sends a new message in a chat-mode [conversation](:method:genie/startconversation).
103
+ * The AI response uses all previously created messages in the conversation to respond.
104
+ */
105
+ async genieCreateConversationMessageBase(req, options) {
106
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
107
+ const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/messages`;
108
+ const body = marshalRequest(req, marshalGenieCreateConversationMessageRequestSchema);
109
+ let resp;
110
+ const call = async (callSignal) => {
111
+ const headers = new Headers({ "Content-Type": "application/json" });
112
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
113
+ headers.set("User-Agent", this.userAgent);
114
+ resp = parseResponse(await executeHttpCall({
115
+ request: buildHttpRequest("POST", url, headers, callSignal, body),
116
+ httpClient,
117
+ logger: this.logger
118
+ }), unmarshalGenieMessageSchema);
119
+ };
120
+ await executeCall(call, options);
121
+ if (resp === void 0) throw new Error("operation completed without a result.");
122
+ return resp;
123
+ }
124
+ /**
125
+ * Sends a new message in a chat-mode [conversation](:method:genie/startconversation).
126
+ * The AI response uses all previously created messages in the conversation to respond.
127
+ */
128
+ async genieCreateConversationMessage(req, options) {
129
+ const resp = await this.genieCreateConversationMessageBase(req, options);
130
+ if (resp.messageId === void 0) throw new Error("response field messageId required for polling is missing");
131
+ if (req.conversationId === void 0) throw new Error("request field conversationId required for polling is missing");
132
+ if (req.spaceId === void 0) throw new Error("request field spaceId required for polling is missing");
133
+ return new GenieCreateConversationMessageWaiter(this, resp.messageId, req.conversationId, req.spaceId);
134
+ }
135
+ /** Creates and runs chat-mode evaluations for multiple benchmark questions in a Genie space. */
136
+ async genieCreateEvalRun(req, options) {
137
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
138
+ const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/eval-runs`;
139
+ const body = marshalRequest(req, marshalGenieCreateEvalRunRequestSchema);
140
+ let resp;
141
+ const call = async (callSignal) => {
142
+ const headers = new Headers({ "Content-Type": "application/json" });
143
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
144
+ headers.set("User-Agent", this.userAgent);
145
+ resp = parseResponse(await executeHttpCall({
146
+ request: buildHttpRequest("POST", url, headers, callSignal, body),
147
+ httpClient,
148
+ logger: this.logger
149
+ }), unmarshalGenieEvalRunResponseSchema);
150
+ };
151
+ await executeCall(call, options);
152
+ if (resp === void 0) throw new Error("operation completed without a result.");
153
+ return resp;
154
+ }
155
+ /** Create a comment on a conversation message. */
156
+ async genieCreateMessageComment(req, options) {
157
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
158
+ const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/messages/${req.messageId ?? ""}/comments`;
159
+ const body = marshalRequest(req, marshalGenieCreateMessageCommentRequestSchema);
160
+ let resp;
161
+ const call = async (callSignal) => {
162
+ const headers = new Headers({ "Content-Type": "application/json" });
163
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
164
+ headers.set("User-Agent", this.userAgent);
165
+ resp = parseResponse(await executeHttpCall({
166
+ request: buildHttpRequest("POST", url, headers, callSignal, body),
167
+ httpClient,
168
+ logger: this.logger
169
+ }), unmarshalGenieMessageCommentSchema);
170
+ };
171
+ await executeCall(call, options);
172
+ if (resp === void 0) throw new Error("operation completed without a result.");
173
+ return resp;
174
+ }
175
+ /** Delete a conversation. */
176
+ async genieDeleteConversation(req, options) {
177
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
178
+ const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}`;
179
+ const call = async (callSignal) => {
180
+ const headers = new Headers();
181
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
182
+ headers.set("User-Agent", this.userAgent);
183
+ await executeHttpCall({
184
+ request: buildHttpRequest("DELETE", url, headers, callSignal),
185
+ httpClient,
186
+ logger: this.logger
187
+ });
188
+ };
189
+ await executeCall(call, options);
190
+ }
191
+ /** Delete a conversation message. */
192
+ async genieDeleteConversationMessage(req, options) {
193
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
194
+ const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/messages/${req.messageId ?? ""}`;
195
+ const call = async (callSignal) => {
196
+ const headers = new Headers();
197
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
198
+ headers.set("User-Agent", this.userAgent);
199
+ await executeHttpCall({
200
+ request: buildHttpRequest("DELETE", url, headers, callSignal),
201
+ httpClient,
202
+ logger: this.logger
203
+ });
204
+ };
205
+ await executeCall(call, options);
206
+ }
207
+ /** Execute the SQL for a message query attachment. Use this API when the query attachment has expired and needs to be re-executed. */
208
+ async genieExecuteMessageAttachmentQuery(req, options) {
209
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
210
+ const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/messages/${req.messageId ?? ""}/attachments/${req.attachmentId ?? ""}/execute-query`;
211
+ const body = marshalRequest(req, marshalGenieExecuteMessageAttachmentQueryRequestSchema);
212
+ let resp;
213
+ const call = async (callSignal) => {
214
+ const headers = new Headers({ "Content-Type": "application/json" });
215
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
216
+ headers.set("User-Agent", this.userAgent);
217
+ resp = parseResponse(await executeHttpCall({
218
+ request: buildHttpRequest("POST", url, headers, callSignal, body),
219
+ httpClient,
220
+ logger: this.logger
221
+ }), unmarshalGenieGetMessageQueryResultResponseSchema);
222
+ };
223
+ await executeCall(call, options);
224
+ if (resp === void 0) throw new Error("operation completed without a result.");
225
+ return resp;
226
+ }
227
+ /** DEPRECATED: Use [Execute Message Attachment Query](:method:genie/executemessageattachmentquery) instead. */
228
+ async genieExecuteMessageQuery(req, options) {
229
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
230
+ const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/messages/${req.messageId ?? ""}/execute-query`;
231
+ const body = marshalRequest(req, marshalGenieExecuteMessageQueryRequestSchema);
232
+ let resp;
233
+ const call = async (callSignal) => {
234
+ const headers = new Headers({ "Content-Type": "application/json" });
235
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
236
+ headers.set("User-Agent", this.userAgent);
237
+ resp = parseResponse(await executeHttpCall({
238
+ request: buildHttpRequest("POST", url, headers, callSignal, body),
239
+ httpClient,
240
+ logger: this.logger
241
+ }), unmarshalGenieGetMessageQueryResultResponseSchema);
242
+ };
243
+ await executeCall(call, options);
244
+ if (resp === void 0) throw new Error("operation completed without a result.");
245
+ return resp;
246
+ }
247
+ /**
248
+ * Initiates a new SQL execution and returns a `download_id` and `download_id_signature` that you can use to track the progress of the download.
249
+ * The query result is stored in an external link and can be retrieved using the [Get Download Full Query Result](:method:genie/getdownloadfullqueryresult) API.
250
+ * Both `download_id` and `download_id_signature` must be provided when calling the Get endpoint.
251
+ *
252
+ * ----
253
+ *
254
+ * ### **Warning: Databricks strongly recommends that you protect the URLs that are returned by the `EXTERNAL_LINKS` disposition.**
255
+ *
256
+ * When you use the `EXTERNAL_LINKS` disposition, a short-lived cloud-storage URL is generated to download the
257
+ * results. The URL contains temporary access credentials, so protect it and do not set an `Authorization` header in
258
+ * the download request.
259
+ *
260
+ *
261
+ *
262
+ *
263
+ *
264
+ * See [Execute Statement](:method:statementexecution/executestatement) for more details.
265
+ *
266
+ * ----
267
+ */
268
+ async genieGenerateDownloadFullQueryResult(req, options) {
269
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
270
+ const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/messages/${req.messageId ?? ""}/attachments/${req.attachmentId ?? ""}/downloads`;
271
+ const body = marshalRequest(req, marshalGenieGenerateDownloadFullQueryResultRequestSchema);
272
+ let resp;
273
+ const call = async (callSignal) => {
274
+ const headers = new Headers({ "Content-Type": "application/json" });
275
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
276
+ headers.set("User-Agent", this.userAgent);
277
+ resp = parseResponse(await executeHttpCall({
278
+ request: buildHttpRequest("POST", url, headers, callSignal, body),
279
+ httpClient,
280
+ logger: this.logger
281
+ }), unmarshalGenieGenerateDownloadFullQueryResultResponseSchema);
282
+ };
283
+ await executeCall(call, options);
284
+ if (resp === void 0) throw new Error("operation completed without a result.");
285
+ return resp;
286
+ }
287
+ /**
288
+ * Gets a message from a chat-mode or agent-mode conversation.
289
+ * For a complete agent-mode transcript, use the List conversation items endpoint.
290
+ */
291
+ async genieGetConversationMessage(req, options) {
292
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
293
+ const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/messages/${req.messageId ?? ""}`;
294
+ let resp;
295
+ const call = async (callSignal) => {
296
+ const headers = new Headers();
297
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
298
+ headers.set("User-Agent", this.userAgent);
299
+ resp = parseResponse(await executeHttpCall({
300
+ request: buildHttpRequest("GET", url, headers, callSignal),
301
+ httpClient,
302
+ logger: this.logger
303
+ }), unmarshalGenieMessageSchema);
304
+ };
305
+ await executeCall(call, options);
306
+ if (resp === void 0) throw new Error("operation completed without a result.");
307
+ return resp;
308
+ }
309
+ /**
310
+ * After [Generating a Full Query Result Download](:method:genie/generatedownloadfullqueryresult) and successfully receiving a `download_id` and `download_id_signature`, use this API to poll the download progress.
311
+ * Both `download_id` and `download_id_signature` are required to call this endpoint.
312
+ * When the download is complete, the API returns the result in the `EXTERNAL_LINKS` disposition, containing one or more external links to the query result files.
313
+ *
314
+ * ----
315
+ *
316
+ * ### **Warning: Databricks strongly recommends that you protect the URLs that are returned by the `EXTERNAL_LINKS` disposition.**
317
+ *
318
+ * When you use the `EXTERNAL_LINKS` disposition, a short-lived cloud-storage URL is generated to download the
319
+ * results. The URL contains temporary access credentials, so protect it and do not set an `Authorization` header in
320
+ * the download request.
321
+ *
322
+ *
323
+ *
324
+ *
325
+ *
326
+ * See [Execute Statement](:method:statementexecution/executestatement) for more details.
327
+ *
328
+ * ----
329
+ */
330
+ async genieGetDownloadFullQueryResult(req, options) {
331
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
332
+ const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/messages/${req.messageId ?? ""}/attachments/${req.attachmentId ?? ""}/downloads/${req.downloadId ?? ""}`;
333
+ const params = new URLSearchParams();
334
+ if (req.downloadIdSignature !== void 0) params.append("download_id_signature", req.downloadIdSignature);
335
+ const query = params.toString();
336
+ const fullUrl = query !== "" ? `${url}?${query}` : url;
337
+ let resp;
338
+ const call = async (callSignal) => {
339
+ const headers = new Headers();
340
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
341
+ headers.set("User-Agent", this.userAgent);
342
+ resp = parseResponse(await executeHttpCall({
343
+ request: buildHttpRequest("GET", fullUrl, headers, callSignal),
344
+ httpClient,
345
+ logger: this.logger
346
+ }), unmarshalGenieGetDownloadFullQueryResultResponseSchema);
347
+ };
348
+ await executeCall(call, options);
349
+ if (resp === void 0) throw new Error("operation completed without a result.");
350
+ return resp;
351
+ }
352
+ /** Get details for evaluation results. */
353
+ async genieGetEvalResultDetails(req, options) {
354
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
355
+ const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/eval-runs/${req.evalRunId ?? ""}/results/${req.resultId ?? ""}`;
356
+ let resp;
357
+ const call = async (callSignal) => {
358
+ const headers = new Headers();
359
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
360
+ headers.set("User-Agent", this.userAgent);
361
+ resp = parseResponse(await executeHttpCall({
362
+ request: buildHttpRequest("GET", url, headers, callSignal),
363
+ httpClient,
364
+ logger: this.logger
365
+ }), unmarshalGenieEvalResultDetailsSchema);
366
+ };
367
+ await executeCall(call, options);
368
+ if (resp === void 0) throw new Error("operation completed without a result.");
369
+ return resp;
370
+ }
371
+ /** Get evaluation run details. */
372
+ async genieGetEvalRun(req, options) {
373
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
374
+ const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/eval-runs/${req.evalRunId ?? ""}`;
375
+ let resp;
376
+ const call = async (callSignal) => {
377
+ const headers = new Headers();
378
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
379
+ headers.set("User-Agent", this.userAgent);
380
+ resp = parseResponse(await executeHttpCall({
381
+ request: buildHttpRequest("GET", url, headers, callSignal),
382
+ httpClient,
383
+ logger: this.logger
384
+ }), unmarshalGenieEvalRunResponseSchema);
385
+ };
386
+ await executeCall(call, options);
387
+ if (resp === void 0) throw new Error("operation completed without a result.");
388
+ return resp;
389
+ }
390
+ /**
391
+ * Get the result of SQL query if the message has a query attachment.
392
+ * This is only available if a message has a query attachment and the message status is `EXECUTING_QUERY` OR `COMPLETED`.
393
+ */
394
+ async genieGetMessageAttachmentQueryResult(req, options) {
395
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
396
+ const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/messages/${req.messageId ?? ""}/attachments/${req.attachmentId ?? ""}/query-result`;
397
+ let resp;
398
+ const call = async (callSignal) => {
399
+ const headers = new Headers();
400
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
401
+ headers.set("User-Agent", this.userAgent);
402
+ resp = parseResponse(await executeHttpCall({
403
+ request: buildHttpRequest("GET", url, headers, callSignal),
404
+ httpClient,
405
+ logger: this.logger
406
+ }), unmarshalGenieGetMessageQueryResultResponseSchema);
407
+ };
408
+ await executeCall(call, options);
409
+ if (resp === void 0) throw new Error("operation completed without a result.");
410
+ return resp;
411
+ }
412
+ /** DEPRECATED: Use [Get Message Attachment Query Result](:method:genie/getmessageattachmentqueryresult) instead. */
413
+ async genieGetMessageQueryResult(req, options) {
414
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
415
+ const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/messages/${req.messageId ?? ""}/query-result`;
416
+ let resp;
417
+ const call = async (callSignal) => {
418
+ const headers = new Headers();
419
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
420
+ headers.set("User-Agent", this.userAgent);
421
+ resp = parseResponse(await executeHttpCall({
422
+ request: buildHttpRequest("GET", url, headers, callSignal),
423
+ httpClient,
424
+ logger: this.logger
425
+ }), unmarshalGenieGetMessageQueryResultResponseSchema);
426
+ };
427
+ await executeCall(call, options);
428
+ if (resp === void 0) throw new Error("operation completed without a result.");
429
+ return resp;
430
+ }
431
+ /** DEPRECATED: Use [Get Message Attachment Query Result](:method:genie/getmessageattachmentqueryresult) instead. */
432
+ async genieGetQueryResultByAttachment(req, options) {
433
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
434
+ const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/messages/${req.messageId ?? ""}/query-result/${req.attachmentId ?? ""}`;
435
+ let resp;
436
+ const call = async (callSignal) => {
437
+ const headers = new Headers();
438
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
439
+ headers.set("User-Agent", this.userAgent);
440
+ resp = parseResponse(await executeHttpCall({
441
+ request: buildHttpRequest("GET", url, headers, callSignal),
442
+ httpClient,
443
+ logger: this.logger
444
+ }), unmarshalGenieGetMessageQueryResultResponseSchema);
445
+ };
446
+ await executeCall(call, options);
447
+ if (resp === void 0) throw new Error("operation completed without a result.");
448
+ return resp;
449
+ }
450
+ /** Get details of a Genie Space. */
451
+ async genieGetSpace(req, options) {
452
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
453
+ const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}`;
454
+ const params = new URLSearchParams();
455
+ if (req.includeSerializedSpace !== void 0) params.append("include_serialized_space", String(req.includeSerializedSpace));
456
+ const query = params.toString();
457
+ const fullUrl = query !== "" ? `${url}?${query}` : url;
458
+ let resp;
459
+ const call = async (callSignal) => {
460
+ const headers = new Headers();
461
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
462
+ headers.set("User-Agent", this.userAgent);
463
+ resp = parseResponse(await executeHttpCall({
464
+ request: buildHttpRequest("GET", fullUrl, headers, callSignal),
465
+ httpClient,
466
+ logger: this.logger
467
+ }), unmarshalGenieSpaceSchema);
468
+ };
469
+ await executeCall(call, options);
470
+ if (resp === void 0) throw new Error("operation completed without a result.");
471
+ return resp;
472
+ }
473
+ /** List all comments across all messages in a conversation. */
474
+ async genieListConversationComments(req, options) {
475
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
476
+ const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/list-comments`;
477
+ const params = new URLSearchParams();
478
+ if (req.pageSize !== void 0) params.append("page_size", String(req.pageSize));
479
+ if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
480
+ const query = params.toString();
481
+ const fullUrl = query !== "" ? `${url}?${query}` : url;
482
+ let resp;
483
+ const call = async (callSignal) => {
484
+ const headers = new Headers();
485
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
486
+ headers.set("User-Agent", this.userAgent);
487
+ resp = parseResponse(await executeHttpCall({
488
+ request: buildHttpRequest("GET", fullUrl, headers, callSignal),
489
+ httpClient,
490
+ logger: this.logger
491
+ }), unmarshalGenieListConversationCommentsResponseSchema);
492
+ };
493
+ await executeCall(call, options);
494
+ if (resp === void 0) throw new Error("operation completed without a result.");
495
+ return resp;
496
+ }
497
+ /**
498
+ * Lists messages in a chat-mode or agent-mode conversation.
499
+ * Agent-mode messages are returned as GenieMessage projections. Use the List conversation items
500
+ * endpoint for the complete reasoning and tool-call history.
501
+ */
502
+ async genieListConversationMessages(req, options) {
503
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
504
+ const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/messages`;
505
+ const params = new URLSearchParams();
506
+ if (req.pageSize !== void 0) params.append("page_size", String(req.pageSize));
507
+ if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
508
+ const query = params.toString();
509
+ const fullUrl = query !== "" ? `${url}?${query}` : url;
510
+ let resp;
511
+ const call = async (callSignal) => {
512
+ const headers = new Headers();
513
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
514
+ headers.set("User-Agent", this.userAgent);
515
+ resp = parseResponse(await executeHttpCall({
516
+ request: buildHttpRequest("GET", fullUrl, headers, callSignal),
517
+ httpClient,
518
+ logger: this.logger
519
+ }), unmarshalGenieListConversationMessagesResponseSchema);
520
+ };
521
+ await executeCall(call, options);
522
+ if (resp === void 0) throw new Error("operation completed without a result.");
523
+ return resp;
524
+ }
525
+ /** Get a list of conversations in a Genie Space. */
526
+ async genieListConversations(req, options) {
527
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
528
+ const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations`;
529
+ const params = new URLSearchParams();
530
+ if (req.pageSize !== void 0) params.append("page_size", String(req.pageSize));
531
+ if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
532
+ if (req.includeAll !== void 0) params.append("include_all", String(req.includeAll));
533
+ const query = params.toString();
534
+ const fullUrl = query !== "" ? `${url}?${query}` : url;
535
+ let resp;
536
+ const call = async (callSignal) => {
537
+ const headers = new Headers();
538
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
539
+ headers.set("User-Agent", this.userAgent);
540
+ resp = parseResponse(await executeHttpCall({
541
+ request: buildHttpRequest("GET", fullUrl, headers, callSignal),
542
+ httpClient,
543
+ logger: this.logger
544
+ }), unmarshalGenieListConversationsResponseSchema);
545
+ };
546
+ await executeCall(call, options);
547
+ if (resp === void 0) throw new Error("operation completed without a result.");
548
+ return resp;
549
+ }
550
+ /** List evaluation results for a specific evaluation run. */
551
+ async genieListEvalResults(req, options) {
552
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
553
+ const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/eval-runs/${req.evalRunId ?? ""}/results`;
554
+ const params = new URLSearchParams();
555
+ if (req.pageSize !== void 0) params.append("page_size", String(req.pageSize));
556
+ if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
557
+ const query = params.toString();
558
+ const fullUrl = query !== "" ? `${url}?${query}` : url;
559
+ let resp;
560
+ const call = async (callSignal) => {
561
+ const headers = new Headers();
562
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
563
+ headers.set("User-Agent", this.userAgent);
564
+ resp = parseResponse(await executeHttpCall({
565
+ request: buildHttpRequest("GET", fullUrl, headers, callSignal),
566
+ httpClient,
567
+ logger: this.logger
568
+ }), unmarshalGenieListEvalResultsResponseSchema);
569
+ };
570
+ await executeCall(call, options);
571
+ if (resp === void 0) throw new Error("operation completed without a result.");
572
+ return resp;
573
+ }
574
+ /** Lists all evaluation runs in a space. */
575
+ async genieListEvalRuns(req, options) {
576
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
577
+ const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/eval-runs`;
578
+ const params = new URLSearchParams();
579
+ if (req.pageSize !== void 0) params.append("page_size", String(req.pageSize));
580
+ if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
581
+ const query = params.toString();
582
+ const fullUrl = query !== "" ? `${url}?${query}` : url;
583
+ let resp;
584
+ const call = async (callSignal) => {
585
+ const headers = new Headers();
586
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
587
+ headers.set("User-Agent", this.userAgent);
588
+ resp = parseResponse(await executeHttpCall({
589
+ request: buildHttpRequest("GET", fullUrl, headers, callSignal),
590
+ httpClient,
591
+ logger: this.logger
592
+ }), unmarshalGenieListEvalRunsResponseSchema);
593
+ };
594
+ await executeCall(call, options);
595
+ if (resp === void 0) throw new Error("operation completed without a result.");
596
+ return resp;
597
+ }
598
+ /** List comments on a specific conversation message. */
599
+ async genieListMessageComments(req, options) {
600
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
601
+ const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/messages/${req.messageId ?? ""}/comments`;
602
+ const params = new URLSearchParams();
603
+ if (req.pageSize !== void 0) params.append("page_size", String(req.pageSize));
604
+ if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
605
+ const query = params.toString();
606
+ const fullUrl = query !== "" ? `${url}?${query}` : url;
607
+ let resp;
608
+ const call = async (callSignal) => {
609
+ const headers = new Headers();
610
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
611
+ headers.set("User-Agent", this.userAgent);
612
+ resp = parseResponse(await executeHttpCall({
613
+ request: buildHttpRequest("GET", fullUrl, headers, callSignal),
614
+ httpClient,
615
+ logger: this.logger
616
+ }), unmarshalGenieListMessageCommentsResponseSchema);
617
+ };
618
+ await executeCall(call, options);
619
+ if (resp === void 0) throw new Error("operation completed without a result.");
620
+ return resp;
621
+ }
622
+ /** Get list of Genie Spaces. */
623
+ async genieListSpaces(req, options) {
624
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
625
+ const url = `${host}/api/2.0/genie/spaces`;
626
+ const params = new URLSearchParams();
627
+ if (req.pageSize !== void 0) params.append("page_size", String(req.pageSize));
628
+ if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
629
+ const query = params.toString();
630
+ const fullUrl = query !== "" ? `${url}?${query}` : url;
631
+ let resp;
632
+ const call = async (callSignal) => {
633
+ const headers = new Headers();
634
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
635
+ headers.set("User-Agent", this.userAgent);
636
+ resp = parseResponse(await executeHttpCall({
637
+ request: buildHttpRequest("GET", fullUrl, headers, callSignal),
638
+ httpClient,
639
+ logger: this.logger
640
+ }), unmarshalGenieListSpacesResponseSchema);
641
+ };
642
+ await executeCall(call, options);
643
+ if (resp === void 0) throw new Error("operation completed without a result.");
644
+ return resp;
645
+ }
646
+ /** Sends feedback for a message in a chat-mode or agent-mode conversation. */
647
+ async genieSendMessageFeedback(req, options) {
648
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
649
+ const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/messages/${req.messageId ?? ""}/feedback`;
650
+ const body = marshalRequest(req, marshalGenieSendMessageFeedbackRequestSchema);
651
+ const call = async (callSignal) => {
652
+ const headers = new Headers({ "Content-Type": "application/json" });
653
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
654
+ headers.set("User-Agent", this.userAgent);
655
+ await executeHttpCall({
656
+ request: buildHttpRequest("POST", url, headers, callSignal, body),
657
+ httpClient,
658
+ logger: this.logger
659
+ });
660
+ };
661
+ await executeCall(call, options);
662
+ }
663
+ /** Starts a new chat-mode conversation and sends its first message. */
664
+ async genieStartConversationBase(req, options) {
665
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
666
+ const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/start-conversation`;
667
+ const body = marshalRequest(req, marshalGenieStartConversationRequestSchema);
668
+ let resp;
669
+ const call = async (callSignal) => {
670
+ const headers = new Headers({ "Content-Type": "application/json" });
671
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
672
+ headers.set("User-Agent", this.userAgent);
673
+ resp = parseResponse(await executeHttpCall({
674
+ request: buildHttpRequest("POST", url, headers, callSignal, body),
675
+ httpClient,
676
+ logger: this.logger
677
+ }), unmarshalGenieStartConversationResponseSchema);
678
+ };
679
+ await executeCall(call, options);
680
+ if (resp === void 0) throw new Error("operation completed without a result.");
681
+ return resp;
682
+ }
683
+ /** Starts a new chat-mode conversation and sends its first message. */
684
+ async genieStartConversation(req, options) {
685
+ const resp = await this.genieStartConversationBase(req, options);
686
+ if (resp.messageId === void 0) throw new Error("response field messageId required for polling is missing");
687
+ if (resp.conversationId === void 0) throw new Error("response field conversationId required for polling is missing");
688
+ if (req.spaceId === void 0) throw new Error("request field spaceId required for polling is missing");
689
+ return new GenieStartConversationWaiter(this, resp.messageId, resp.conversationId, req.spaceId);
690
+ }
691
+ /** Move a Genie Space to the trash. */
692
+ async genieTrashSpace(req, options) {
693
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
694
+ const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}`;
695
+ const call = async (callSignal) => {
696
+ const headers = new Headers();
697
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
698
+ headers.set("User-Agent", this.userAgent);
699
+ await executeHttpCall({
700
+ request: buildHttpRequest("DELETE", url, headers, callSignal),
701
+ httpClient,
702
+ logger: this.logger
703
+ });
704
+ };
705
+ await executeCall(call, options);
706
+ }
707
+ /** Updates a Genie space with a serialized payload. */
708
+ async updateSpace(req, options) {
709
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
710
+ const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}`;
711
+ const body = marshalRequest(req, marshalGenieUpdateSpaceRequestSchema);
712
+ let resp;
713
+ const call = async (callSignal) => {
714
+ const headers = new Headers({ "Content-Type": "application/json" });
715
+ if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
716
+ headers.set("User-Agent", this.userAgent);
717
+ resp = parseResponse(await executeHttpCall({
718
+ request: buildHttpRequest("PATCH", url, headers, callSignal, body),
719
+ httpClient,
720
+ logger: this.logger
721
+ }), unmarshalGenieSpaceSchema);
722
+ };
723
+ await executeCall(call, options);
724
+ if (resp === void 0) throw new Error("operation completed without a result.");
725
+ return resp;
726
+ }
727
+ };
728
+ var GenieCreateConversationMessageWaiter = class {
729
+ constructor(client, messageId, conversationId, spaceId) {
730
+ this.client = client;
731
+ this.messageId = messageId;
732
+ this.conversationId = conversationId;
733
+ this.spaceId = spaceId;
734
+ }
735
+ /**
736
+ * Polls until the operation reaches a terminal state.
737
+ *
738
+ * Throws if a failure state is reached.
739
+ */
740
+ async wait(options) {
741
+ let result;
742
+ const call = async (callSignal) => {
743
+ const pollResp = await this.client.genieGetConversationMessage({
744
+ messageId: this.messageId,
745
+ conversationId: this.conversationId,
746
+ spaceId: this.spaceId
747
+ }, callSignal !== void 0 ? { signal: callSignal } : void 0);
748
+ const status = pollResp.status;
749
+ if (status === void 0) throw new Error("response missing required status field");
750
+ switch (status) {
751
+ case MessageStatus_MessageStatus.COMPLETED:
752
+ result = pollResp;
753
+ return;
754
+ case MessageStatus_MessageStatus.FAILED: throw new Error(`terminal state ${status}: (no message)`);
755
+ default: throw new StillRunningError();
756
+ }
757
+ };
758
+ await executeWait(call, options);
759
+ if (result === void 0) throw new Error("operation completed without a result.");
760
+ return result;
761
+ }
762
+ /** Checks whether the operation has reached a terminal state. */
763
+ async done(options) {
764
+ const status = (await this.client.genieGetConversationMessage({
765
+ messageId: this.messageId,
766
+ conversationId: this.conversationId,
767
+ spaceId: this.spaceId
768
+ }, options)).status;
769
+ if (status === void 0) throw new Error("response missing required status field");
770
+ switch (status) {
771
+ case MessageStatus_MessageStatus.COMPLETED:
772
+ case MessageStatus_MessageStatus.FAILED: return true;
773
+ default: return false;
774
+ }
775
+ }
776
+ };
777
+ var GenieStartConversationWaiter = class {
778
+ constructor(client, messageId, conversationId, spaceId) {
779
+ this.client = client;
780
+ this.messageId = messageId;
781
+ this.conversationId = conversationId;
782
+ this.spaceId = spaceId;
783
+ }
784
+ /**
785
+ * Polls until the operation reaches a terminal state.
786
+ *
787
+ * Throws if a failure state is reached.
788
+ */
789
+ async wait(options) {
790
+ let result;
791
+ const call = async (callSignal) => {
792
+ const pollResp = await this.client.genieGetConversationMessage({
793
+ messageId: this.messageId,
794
+ conversationId: this.conversationId,
795
+ spaceId: this.spaceId
796
+ }, callSignal !== void 0 ? { signal: callSignal } : void 0);
797
+ const status = pollResp.status;
798
+ if (status === void 0) throw new Error("response missing required status field");
799
+ switch (status) {
800
+ case MessageStatus_MessageStatus.COMPLETED:
801
+ result = pollResp;
802
+ return;
803
+ case MessageStatus_MessageStatus.FAILED: throw new Error(`terminal state ${status}: (no message)`);
804
+ default: throw new StillRunningError();
805
+ }
806
+ };
807
+ await executeWait(call, options);
808
+ if (result === void 0) throw new Error("operation completed without a result.");
809
+ return result;
810
+ }
811
+ /** Checks whether the operation has reached a terminal state. */
812
+ async done(options) {
813
+ const status = (await this.client.genieGetConversationMessage({
814
+ messageId: this.messageId,
815
+ conversationId: this.conversationId,
816
+ spaceId: this.spaceId
817
+ }, options)).status;
818
+ if (status === void 0) throw new Error("response missing required status field");
819
+ switch (status) {
820
+ case MessageStatus_MessageStatus.COMPLETED:
821
+ case MessageStatus_MessageStatus.FAILED: return true;
822
+ default: return false;
823
+ }
824
+ }
825
+ };
826
+
827
+ //#endregion
828
+ export { GenieClient, GenieCreateConversationMessageWaiter, GenieStartConversationWaiter };
829
+ //# sourceMappingURL=client.js.map