@dbx-tools/genie 0.1.25 → 0.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/chat.js +19 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/src/chat.ts +24 -10
package/package.json
CHANGED
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
}
|
|
10
10
|
},
|
|
11
11
|
"name": "@dbx-tools/genie",
|
|
12
|
-
"version": "0.1.
|
|
12
|
+
"version": "0.1.26",
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@databricks/sdk-experimental": "^0.17",
|
|
15
|
-
"@dbx-tools/genie-shared": "0.1.
|
|
16
|
-
"@dbx-tools/shared": "0.1.
|
|
15
|
+
"@dbx-tools/genie-shared": "0.1.26",
|
|
16
|
+
"@dbx-tools/shared": "0.1.26"
|
|
17
17
|
},
|
|
18
18
|
"module": "index.ts",
|
|
19
19
|
"type": "module",
|
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
"src"
|
|
24
24
|
],
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
|
-
"homepage": "https://github.com/reggie-db/dbx-tools-
|
|
26
|
+
"homepage": "https://github.com/reggie-db/dbx-tools-js#readme",
|
|
27
27
|
"bugs": {
|
|
28
|
-
"url": "https://github.com/reggie-db/dbx-tools-
|
|
28
|
+
"url": "https://github.com/reggie-db/dbx-tools-js/issues"
|
|
29
29
|
},
|
|
30
30
|
"repository": {
|
|
31
31
|
"type": "git",
|
|
32
|
-
"url": "git+https://github.com/reggie-db/dbx-tools-
|
|
32
|
+
"url": "git+https://github.com/reggie-db/dbx-tools-js.git",
|
|
33
33
|
"directory": "packages/genie"
|
|
34
34
|
}
|
|
35
35
|
}
|
package/src/chat.ts
CHANGED
|
@@ -132,9 +132,7 @@ export async function* genieChat(
|
|
|
132
132
|
// `conversation_id`, retrying would just open conversation
|
|
133
133
|
// after conversation.
|
|
134
134
|
if (ctx.attempt > 0) {
|
|
135
|
-
throw new Error(
|
|
136
|
-
"Genie did not return a conversation id; refusing to retry",
|
|
137
|
-
);
|
|
135
|
+
throw new Error("Genie did not return a conversation id; refusing to retry");
|
|
138
136
|
}
|
|
139
137
|
const startResponse = await client.genie.startConversation(
|
|
140
138
|
{ space_id, content },
|
|
@@ -151,11 +149,10 @@ export async function* genieChat(
|
|
|
151
149
|
// ... }`). Strip `wait` here so downstream serializers
|
|
152
150
|
// (e.g. yaml.stringify in poll-chat) don't choke on the
|
|
153
151
|
// AsyncFunction value.
|
|
154
|
-
const { wait: _wait, ...createResponse } =
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
);
|
|
152
|
+
const { wait: _wait, ...createResponse } = await client.genie.createMessage(
|
|
153
|
+
{ space_id, conversation_id: conversationId, content },
|
|
154
|
+
context,
|
|
155
|
+
);
|
|
159
156
|
messageId = createResponse.message_id;
|
|
160
157
|
return createResponse;
|
|
161
158
|
}
|
|
@@ -249,8 +246,25 @@ export async function* genieEventChat(
|
|
|
249
246
|
// as the grouping key for every event in this turn). The first
|
|
250
247
|
// snapshot is the earliest point that id exists.
|
|
251
248
|
let questionEmitted = false;
|
|
252
|
-
for await (const
|
|
253
|
-
|
|
249
|
+
for await (const rawMessage of genieChat(space_id, content, options)) {
|
|
250
|
+
// Normalize `message_id` from the legacy `id` field when Genie's
|
|
251
|
+
// wire response only populates one of them. The SDK schema marks
|
|
252
|
+
// both as required, but in practice the `startConversation` /
|
|
253
|
+
// `createMessage` inner `message` payload sometimes ships only
|
|
254
|
+
// `id` while the new `message_id` field lands undefined. Every
|
|
255
|
+
// downstream event detector keys grouping off `message_id`; the
|
|
256
|
+
// fallback keeps one Genie turn's events from splitting across
|
|
257
|
+
// an anon group + the real-id group when subscribers bucket by
|
|
258
|
+
// `message_id` (see `summarizeProgress` in the demo UI).
|
|
259
|
+
const message: GenieMessage = rawMessage.message_id
|
|
260
|
+
? rawMessage
|
|
261
|
+
: { ...rawMessage, message_id: rawMessage.id };
|
|
262
|
+
yield {
|
|
263
|
+
type: "message",
|
|
264
|
+
space_id: message.space_id,
|
|
265
|
+
message_id: message.message_id,
|
|
266
|
+
message,
|
|
267
|
+
};
|
|
254
268
|
if (!questionEmitted) {
|
|
255
269
|
yield {
|
|
256
270
|
type: "question",
|