@dremio/js-sdk 0.61.0 → 0.62.1
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/README.md +28 -1
- package/dist/cloud/ai/AIResource.d.ts +90 -0
- package/dist/enterprise/ai/AIResource.d.ts +90 -0
- package/dist/enterprise/ai/chat/chatEventSchema.d.ts +33 -0
- package/dist/enterprise/ai/chat/chatEventSchema.js +22 -0
- package/dist/enterprise/ai/chat/chatEventSchema.js.map +1 -1
- package/dist/enterprise/ai/conversations/AgentConversation.d.ts +30 -0
- package/dist/enterprise/ai/conversations/createConversationMachine.d.ts +90 -0
- package/dist/enterprise/ai/conversations/createConversationMachine.js +1 -0
- package/dist/enterprise/ai/conversations/createConversationMachine.js.map +1 -1
- package/dist/enterprise/ai/conversations/methods/retrieveConversationHistory.d.ts +15 -0
- package/dist/enterprise/ai/conversations/reduceChatEvents.d.ts +5 -1
- package/dist/enterprise/ai/conversations/reduceChatEvents.js +93 -0
- package/dist/enterprise/ai/conversations/reduceChatEvents.js.map +1 -1
- package/dist/enterprise/ai/index.d.ts +3 -3
- package/dist/enterprise/ai/index.js.map +1 -1
- package/dist-iife/cloud.js +110 -1
- package/dist-iife/enterprise.js +110 -1
- package/package.json +1 -1
package/dist-iife/cloud.js
CHANGED
|
@@ -17251,6 +17251,14 @@ var DremioCloud = (() => {
|
|
|
17251
17251
|
toolExecutionId: string2(),
|
|
17252
17252
|
toolName: string2()
|
|
17253
17253
|
});
|
|
17254
|
+
var selectedSkillInfoSchema = object({
|
|
17255
|
+
id: string2(),
|
|
17256
|
+
name: string2()
|
|
17257
|
+
});
|
|
17258
|
+
var selectedSkillsChunkSchema = object({
|
|
17259
|
+
chunkType: literal("selectedSkills"),
|
|
17260
|
+
selectedSkills: array(selectedSkillInfoSchema)
|
|
17261
|
+
});
|
|
17254
17262
|
var userMessageChunkSchema = object({
|
|
17255
17263
|
chunkType: literal("userMessage"),
|
|
17256
17264
|
text: string2()
|
|
@@ -17268,6 +17276,7 @@ var DremioCloud = (() => {
|
|
|
17268
17276
|
extend2(conversationUpdateChunkSchema, chatEventSharedSchema),
|
|
17269
17277
|
extend2(jobUpdateChunkSchema, chatEventSharedSchema),
|
|
17270
17278
|
extend2(modelChunkSchema, chatEventSharedSchema),
|
|
17279
|
+
extend2(selectedSkillsChunkSchema, chatEventSharedSchema),
|
|
17271
17280
|
extend2(sandboxProgressChunkSchema, chatEventSharedSchema),
|
|
17272
17281
|
sandboxStdoutChatEventSchema,
|
|
17273
17282
|
extend2(toolRequestChunkSchema, chatEventSharedSchema),
|
|
@@ -17298,6 +17307,10 @@ var DremioCloud = (() => {
|
|
|
17298
17307
|
role: literal("agent")
|
|
17299
17308
|
}),
|
|
17300
17309
|
extend2(chatEventOutputSharedSchema, { content: modelChunkSchema, role: literal("agent") }),
|
|
17310
|
+
extend2(chatEventOutputSharedSchema, {
|
|
17311
|
+
content: selectedSkillsChunkSchema,
|
|
17312
|
+
role: literal("agent")
|
|
17313
|
+
}),
|
|
17301
17314
|
extend2(chatEventOutputSharedSchema, {
|
|
17302
17315
|
content: sandboxProgressChunkSchema,
|
|
17303
17316
|
role: literal("agent")
|
|
@@ -17391,6 +17404,15 @@ var DremioCloud = (() => {
|
|
|
17391
17404
|
},
|
|
17392
17405
|
role: "agent"
|
|
17393
17406
|
};
|
|
17407
|
+
case "selectedSkills":
|
|
17408
|
+
return {
|
|
17409
|
+
...sharedProperties,
|
|
17410
|
+
content: {
|
|
17411
|
+
chunkType: "selectedSkills",
|
|
17412
|
+
selectedSkills: v2.selectedSkills
|
|
17413
|
+
},
|
|
17414
|
+
role: "agent"
|
|
17415
|
+
};
|
|
17394
17416
|
case "sandboxProgress":
|
|
17395
17417
|
return {
|
|
17396
17418
|
...sharedProperties,
|
|
@@ -19457,6 +19479,7 @@ var DremioCloud = (() => {
|
|
|
19457
19479
|
var constructorString = Object.prototype.constructor.toString();
|
|
19458
19480
|
|
|
19459
19481
|
// dist/enterprise/ai/conversations/reduceChatEvents.js
|
|
19482
|
+
var selectedSkillsCursorKey = "__dremioSelectedSkillsCursor";
|
|
19460
19483
|
function applyChatEventToConversation(draft, chatEvent) {
|
|
19461
19484
|
let conversationExchange = draft.findLast((exchange) => exchange.id === chatEvent.runId);
|
|
19462
19485
|
if (!conversationExchange) {
|
|
@@ -19480,6 +19503,10 @@ var DremioCloud = (() => {
|
|
|
19480
19503
|
}
|
|
19481
19504
|
break;
|
|
19482
19505
|
}
|
|
19506
|
+
case "selectedSkills": {
|
|
19507
|
+
applySelectedSkillsMetadata(conversationExchange, chatEvent);
|
|
19508
|
+
break;
|
|
19509
|
+
}
|
|
19483
19510
|
case "error":
|
|
19484
19511
|
case "model":
|
|
19485
19512
|
case "sandboxProgress":
|
|
@@ -19517,6 +19544,87 @@ var DremioCloud = (() => {
|
|
|
19517
19544
|
}
|
|
19518
19545
|
}
|
|
19519
19546
|
}
|
|
19547
|
+
function applySelectedSkillsMetadata(conversationExchange, chatEvent) {
|
|
19548
|
+
if (!isSelectedSkillsEventNewer(conversationExchange.runMetadata, chatEvent)) {
|
|
19549
|
+
return;
|
|
19550
|
+
}
|
|
19551
|
+
conversationExchange.runMetadata ??= {};
|
|
19552
|
+
const selectedSkills = [...chatEvent.content.selectedSkills];
|
|
19553
|
+
setSelectedSkillsCursor(selectedSkills, {
|
|
19554
|
+
messagePosition: parseMessagePosition(chatEvent.id),
|
|
19555
|
+
updatedAt: chatEvent.createdAt
|
|
19556
|
+
});
|
|
19557
|
+
conversationExchange.runMetadata.selectedSkills = selectedSkills;
|
|
19558
|
+
}
|
|
19559
|
+
function isSelectedSkillsEventNewer(runMetadata, chatEvent) {
|
|
19560
|
+
const cursor = getSelectedSkillsCursor(runMetadata);
|
|
19561
|
+
if (!cursor) {
|
|
19562
|
+
return true;
|
|
19563
|
+
}
|
|
19564
|
+
const timestampComparison = Xn.Instant.compare(chatEvent.createdAt, cursor.updatedAt);
|
|
19565
|
+
if (timestampComparison !== 0) {
|
|
19566
|
+
return timestampComparison > 0;
|
|
19567
|
+
}
|
|
19568
|
+
const messagePositionComparison = compareMessagePositions(parseMessagePosition(chatEvent.id), cursor.messagePosition);
|
|
19569
|
+
if (messagePositionComparison !== void 0) {
|
|
19570
|
+
return messagePositionComparison >= 0;
|
|
19571
|
+
}
|
|
19572
|
+
return true;
|
|
19573
|
+
}
|
|
19574
|
+
function getSelectedSkillsCursor(runMetadata) {
|
|
19575
|
+
return runMetadata?.selectedSkills?.[selectedSkillsCursorKey];
|
|
19576
|
+
}
|
|
19577
|
+
function setSelectedSkillsCursor(selectedSkills, cursor) {
|
|
19578
|
+
Object.defineProperty(selectedSkills, selectedSkillsCursorKey, {
|
|
19579
|
+
configurable: true,
|
|
19580
|
+
enumerable: false,
|
|
19581
|
+
value: cursor,
|
|
19582
|
+
writable: true
|
|
19583
|
+
});
|
|
19584
|
+
}
|
|
19585
|
+
function parseMessagePosition(messageId) {
|
|
19586
|
+
const parts = messageId.split(":");
|
|
19587
|
+
if (parts.length < 2 || parts.length > 3) {
|
|
19588
|
+
return void 0;
|
|
19589
|
+
}
|
|
19590
|
+
const [chunkId, messageSubId, partId] = parts;
|
|
19591
|
+
if (!chunkId) {
|
|
19592
|
+
return void 0;
|
|
19593
|
+
}
|
|
19594
|
+
const parsedMessageSubId = parseNonNegativeInteger(messageSubId);
|
|
19595
|
+
if (parsedMessageSubId === void 0) {
|
|
19596
|
+
return void 0;
|
|
19597
|
+
}
|
|
19598
|
+
const parsedPartId = partId === void 0 ? void 0 : parseNonNegativeInteger(partId);
|
|
19599
|
+
if (partId !== void 0 && parsedPartId === void 0) {
|
|
19600
|
+
return void 0;
|
|
19601
|
+
}
|
|
19602
|
+
return {
|
|
19603
|
+
chunkId,
|
|
19604
|
+
messageSubId: parsedMessageSubId,
|
|
19605
|
+
partId: parsedPartId
|
|
19606
|
+
};
|
|
19607
|
+
}
|
|
19608
|
+
function parseNonNegativeInteger(value) {
|
|
19609
|
+
if (value === void 0 || !/^\d+$/.test(value)) {
|
|
19610
|
+
return void 0;
|
|
19611
|
+
}
|
|
19612
|
+
const parsedValue = Number(value);
|
|
19613
|
+
if (!Number.isSafeInteger(parsedValue)) {
|
|
19614
|
+
return void 0;
|
|
19615
|
+
}
|
|
19616
|
+
return parsedValue;
|
|
19617
|
+
}
|
|
19618
|
+
function compareMessagePositions(incoming, current2) {
|
|
19619
|
+
if (!incoming || !current2 || incoming.chunkId !== current2.chunkId) {
|
|
19620
|
+
return void 0;
|
|
19621
|
+
}
|
|
19622
|
+
const messageSubIdComparison = incoming.messageSubId - current2.messageSubId;
|
|
19623
|
+
if (messageSubIdComparison !== 0) {
|
|
19624
|
+
return messageSubIdComparison;
|
|
19625
|
+
}
|
|
19626
|
+
return (incoming.partId ?? 0) - (current2.partId ?? 0);
|
|
19627
|
+
}
|
|
19520
19628
|
function reduceChatEvents(state = [], chatEvents) {
|
|
19521
19629
|
return create(state, (draft) => {
|
|
19522
19630
|
for (const chatEvent of chatEvents) {
|
|
@@ -23155,7 +23263,8 @@ ${err.message}`);
|
|
|
23155
23263
|
actions: assign({
|
|
23156
23264
|
conversationSnapshot: ({ context: context2, event }) => AgentConversation.reduceChatEvents(context2.conversationSnapshot, event.output.history.data),
|
|
23157
23265
|
currentRunId: ({ event }) => event.output.conversation.currentRunId,
|
|
23158
|
-
receivedEndOfStream: false
|
|
23266
|
+
receivedEndOfStream: false,
|
|
23267
|
+
streamRetryCount: 0
|
|
23159
23268
|
}),
|
|
23160
23269
|
guard: ({ event }) => !!event.output.conversation.currentRunId,
|
|
23161
23270
|
target: "streaming"
|
package/dist-iife/enterprise.js
CHANGED
|
@@ -16170,6 +16170,14 @@ var DremioEnterprise = (() => {
|
|
|
16170
16170
|
toolExecutionId: string2(),
|
|
16171
16171
|
toolName: string2()
|
|
16172
16172
|
});
|
|
16173
|
+
var selectedSkillInfoSchema = object({
|
|
16174
|
+
id: string2(),
|
|
16175
|
+
name: string2()
|
|
16176
|
+
});
|
|
16177
|
+
var selectedSkillsChunkSchema = object({
|
|
16178
|
+
chunkType: literal("selectedSkills"),
|
|
16179
|
+
selectedSkills: array(selectedSkillInfoSchema)
|
|
16180
|
+
});
|
|
16173
16181
|
var userMessageChunkSchema = object({
|
|
16174
16182
|
chunkType: literal("userMessage"),
|
|
16175
16183
|
text: string2()
|
|
@@ -16187,6 +16195,7 @@ var DremioEnterprise = (() => {
|
|
|
16187
16195
|
extend2(conversationUpdateChunkSchema, chatEventSharedSchema),
|
|
16188
16196
|
extend2(jobUpdateChunkSchema, chatEventSharedSchema),
|
|
16189
16197
|
extend2(modelChunkSchema, chatEventSharedSchema),
|
|
16198
|
+
extend2(selectedSkillsChunkSchema, chatEventSharedSchema),
|
|
16190
16199
|
extend2(sandboxProgressChunkSchema, chatEventSharedSchema),
|
|
16191
16200
|
sandboxStdoutChatEventSchema,
|
|
16192
16201
|
extend2(toolRequestChunkSchema, chatEventSharedSchema),
|
|
@@ -16217,6 +16226,10 @@ var DremioEnterprise = (() => {
|
|
|
16217
16226
|
role: literal("agent")
|
|
16218
16227
|
}),
|
|
16219
16228
|
extend2(chatEventOutputSharedSchema, { content: modelChunkSchema, role: literal("agent") }),
|
|
16229
|
+
extend2(chatEventOutputSharedSchema, {
|
|
16230
|
+
content: selectedSkillsChunkSchema,
|
|
16231
|
+
role: literal("agent")
|
|
16232
|
+
}),
|
|
16220
16233
|
extend2(chatEventOutputSharedSchema, {
|
|
16221
16234
|
content: sandboxProgressChunkSchema,
|
|
16222
16235
|
role: literal("agent")
|
|
@@ -16310,6 +16323,15 @@ var DremioEnterprise = (() => {
|
|
|
16310
16323
|
},
|
|
16311
16324
|
role: "agent"
|
|
16312
16325
|
};
|
|
16326
|
+
case "selectedSkills":
|
|
16327
|
+
return {
|
|
16328
|
+
...sharedProperties,
|
|
16329
|
+
content: {
|
|
16330
|
+
chunkType: "selectedSkills",
|
|
16331
|
+
selectedSkills: v2.selectedSkills
|
|
16332
|
+
},
|
|
16333
|
+
role: "agent"
|
|
16334
|
+
};
|
|
16313
16335
|
case "sandboxProgress":
|
|
16314
16336
|
return {
|
|
16315
16337
|
...sharedProperties,
|
|
@@ -18027,6 +18049,7 @@ var DremioEnterprise = (() => {
|
|
|
18027
18049
|
var constructorString = Object.prototype.constructor.toString();
|
|
18028
18050
|
|
|
18029
18051
|
// dist/enterprise/ai/conversations/reduceChatEvents.js
|
|
18052
|
+
var selectedSkillsCursorKey = "__dremioSelectedSkillsCursor";
|
|
18030
18053
|
function applyChatEventToConversation(draft, chatEvent) {
|
|
18031
18054
|
let conversationExchange = draft.findLast((exchange) => exchange.id === chatEvent.runId);
|
|
18032
18055
|
if (!conversationExchange) {
|
|
@@ -18050,6 +18073,10 @@ var DremioEnterprise = (() => {
|
|
|
18050
18073
|
}
|
|
18051
18074
|
break;
|
|
18052
18075
|
}
|
|
18076
|
+
case "selectedSkills": {
|
|
18077
|
+
applySelectedSkillsMetadata(conversationExchange, chatEvent);
|
|
18078
|
+
break;
|
|
18079
|
+
}
|
|
18053
18080
|
case "error":
|
|
18054
18081
|
case "model":
|
|
18055
18082
|
case "sandboxProgress":
|
|
@@ -18087,6 +18114,87 @@ var DremioEnterprise = (() => {
|
|
|
18087
18114
|
}
|
|
18088
18115
|
}
|
|
18089
18116
|
}
|
|
18117
|
+
function applySelectedSkillsMetadata(conversationExchange, chatEvent) {
|
|
18118
|
+
if (!isSelectedSkillsEventNewer(conversationExchange.runMetadata, chatEvent)) {
|
|
18119
|
+
return;
|
|
18120
|
+
}
|
|
18121
|
+
conversationExchange.runMetadata ??= {};
|
|
18122
|
+
const selectedSkills = [...chatEvent.content.selectedSkills];
|
|
18123
|
+
setSelectedSkillsCursor(selectedSkills, {
|
|
18124
|
+
messagePosition: parseMessagePosition(chatEvent.id),
|
|
18125
|
+
updatedAt: chatEvent.createdAt
|
|
18126
|
+
});
|
|
18127
|
+
conversationExchange.runMetadata.selectedSkills = selectedSkills;
|
|
18128
|
+
}
|
|
18129
|
+
function isSelectedSkillsEventNewer(runMetadata, chatEvent) {
|
|
18130
|
+
const cursor = getSelectedSkillsCursor(runMetadata);
|
|
18131
|
+
if (!cursor) {
|
|
18132
|
+
return true;
|
|
18133
|
+
}
|
|
18134
|
+
const timestampComparison = Xn.Instant.compare(chatEvent.createdAt, cursor.updatedAt);
|
|
18135
|
+
if (timestampComparison !== 0) {
|
|
18136
|
+
return timestampComparison > 0;
|
|
18137
|
+
}
|
|
18138
|
+
const messagePositionComparison = compareMessagePositions(parseMessagePosition(chatEvent.id), cursor.messagePosition);
|
|
18139
|
+
if (messagePositionComparison !== void 0) {
|
|
18140
|
+
return messagePositionComparison >= 0;
|
|
18141
|
+
}
|
|
18142
|
+
return true;
|
|
18143
|
+
}
|
|
18144
|
+
function getSelectedSkillsCursor(runMetadata) {
|
|
18145
|
+
return runMetadata?.selectedSkills?.[selectedSkillsCursorKey];
|
|
18146
|
+
}
|
|
18147
|
+
function setSelectedSkillsCursor(selectedSkills, cursor) {
|
|
18148
|
+
Object.defineProperty(selectedSkills, selectedSkillsCursorKey, {
|
|
18149
|
+
configurable: true,
|
|
18150
|
+
enumerable: false,
|
|
18151
|
+
value: cursor,
|
|
18152
|
+
writable: true
|
|
18153
|
+
});
|
|
18154
|
+
}
|
|
18155
|
+
function parseMessagePosition(messageId) {
|
|
18156
|
+
const parts = messageId.split(":");
|
|
18157
|
+
if (parts.length < 2 || parts.length > 3) {
|
|
18158
|
+
return void 0;
|
|
18159
|
+
}
|
|
18160
|
+
const [chunkId, messageSubId, partId] = parts;
|
|
18161
|
+
if (!chunkId) {
|
|
18162
|
+
return void 0;
|
|
18163
|
+
}
|
|
18164
|
+
const parsedMessageSubId = parseNonNegativeInteger(messageSubId);
|
|
18165
|
+
if (parsedMessageSubId === void 0) {
|
|
18166
|
+
return void 0;
|
|
18167
|
+
}
|
|
18168
|
+
const parsedPartId = partId === void 0 ? void 0 : parseNonNegativeInteger(partId);
|
|
18169
|
+
if (partId !== void 0 && parsedPartId === void 0) {
|
|
18170
|
+
return void 0;
|
|
18171
|
+
}
|
|
18172
|
+
return {
|
|
18173
|
+
chunkId,
|
|
18174
|
+
messageSubId: parsedMessageSubId,
|
|
18175
|
+
partId: parsedPartId
|
|
18176
|
+
};
|
|
18177
|
+
}
|
|
18178
|
+
function parseNonNegativeInteger(value) {
|
|
18179
|
+
if (value === void 0 || !/^\d+$/.test(value)) {
|
|
18180
|
+
return void 0;
|
|
18181
|
+
}
|
|
18182
|
+
const parsedValue = Number(value);
|
|
18183
|
+
if (!Number.isSafeInteger(parsedValue)) {
|
|
18184
|
+
return void 0;
|
|
18185
|
+
}
|
|
18186
|
+
return parsedValue;
|
|
18187
|
+
}
|
|
18188
|
+
function compareMessagePositions(incoming, current2) {
|
|
18189
|
+
if (!incoming || !current2 || incoming.chunkId !== current2.chunkId) {
|
|
18190
|
+
return void 0;
|
|
18191
|
+
}
|
|
18192
|
+
const messageSubIdComparison = incoming.messageSubId - current2.messageSubId;
|
|
18193
|
+
if (messageSubIdComparison !== 0) {
|
|
18194
|
+
return messageSubIdComparison;
|
|
18195
|
+
}
|
|
18196
|
+
return (incoming.partId ?? 0) - (current2.partId ?? 0);
|
|
18197
|
+
}
|
|
18090
18198
|
function reduceChatEvents(state = [], chatEvents) {
|
|
18091
18199
|
return create(state, (draft) => {
|
|
18092
18200
|
for (const chatEvent of chatEvents) {
|
|
@@ -21725,7 +21833,8 @@ ${err.message}`);
|
|
|
21725
21833
|
actions: assign({
|
|
21726
21834
|
conversationSnapshot: ({ context: context2, event }) => AgentConversation.reduceChatEvents(context2.conversationSnapshot, event.output.history.data),
|
|
21727
21835
|
currentRunId: ({ event }) => event.output.conversation.currentRunId,
|
|
21728
|
-
receivedEndOfStream: false
|
|
21836
|
+
receivedEndOfStream: false,
|
|
21837
|
+
streamRetryCount: 0
|
|
21729
21838
|
}),
|
|
21730
21839
|
guard: ({ event }) => !!event.output.conversation.currentRunId,
|
|
21731
21840
|
target: "streaming"
|