@dremio/js-sdk 0.43.0 → 0.44.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.
- package/README.md +185 -121
- package/dist/cloud/ai/AIResource.d.ts +73 -1
- package/dist/enterprise/ai/AIResource.d.ts +73 -1
- package/dist/enterprise/ai/chat/chatEventSchema.d.ts +19 -0
- package/dist/enterprise/ai/chat/chatEventSchema.js +16 -0
- package/dist/enterprise/ai/chat/chatEventSchema.js.map +1 -1
- package/dist/enterprise/ai/conversations/AgentConversation.d.ts +22 -0
- package/dist/enterprise/ai/conversations/createConversationMachine.d.ts +81 -1
- package/dist/enterprise/ai/conversations/createConversationMachine.js +36 -26
- package/dist/enterprise/ai/conversations/createConversationMachine.js.map +1 -1
- package/dist/enterprise/ai/conversations/methods/retrieveConversationHistory.d.ts +11 -0
- package/dist/enterprise/ai/conversations/reduceChatEvents.d.ts +1 -1
- package/dist/enterprise/ai/conversations/reduceChatEvents.js +8 -0
- package/dist/enterprise/ai/conversations/reduceChatEvents.js.map +1 -1
- package/dist-iife/cloud.js +58 -24
- package/dist-iife/enterprise.js +58 -24
- package/package.json +1 -1
package/dist-iife/cloud.js
CHANGED
|
@@ -23890,6 +23890,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
23890
23890
|
summary: optional(string2()),
|
|
23891
23891
|
title: optional(string2())
|
|
23892
23892
|
});
|
|
23893
|
+
var endOfStreamChunkSchema = object({
|
|
23894
|
+
chunkType: literal("endOfStream")
|
|
23895
|
+
});
|
|
23893
23896
|
var modelChunkSchema = object({
|
|
23894
23897
|
chunkType: literal("model"),
|
|
23895
23898
|
name: string2().check(_trim(), _minLength(1)),
|
|
@@ -23928,6 +23931,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
23928
23931
|
]);
|
|
23929
23932
|
var chatEventInputSchema = discriminatedUnion("chunkType", [
|
|
23930
23933
|
errorChunkSchema,
|
|
23934
|
+
extend2(endOfStreamChunkSchema, chatEventSharedSchema),
|
|
23931
23935
|
extend2(conversationUpdateChunkSchema, chatEventSharedSchema),
|
|
23932
23936
|
extend2(modelChunkSchema, chatEventSharedSchema),
|
|
23933
23937
|
extend2(toolRequestChunkSchema, chatEventSharedSchema),
|
|
@@ -23944,6 +23948,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
23944
23948
|
role: literal("agent")
|
|
23945
23949
|
}),
|
|
23946
23950
|
extend2(chatEventOutputSharedSchema, { content: errorChunkSchema, role: literal("agent") }),
|
|
23951
|
+
extend2(chatEventOutputSharedSchema, {
|
|
23952
|
+
content: endOfStreamChunkSchema,
|
|
23953
|
+
role: literal("agent")
|
|
23954
|
+
}),
|
|
23947
23955
|
extend2(chatEventOutputSharedSchema, { content: modelChunkSchema, role: literal("agent") }),
|
|
23948
23956
|
extend2(chatEventOutputSharedSchema, {
|
|
23949
23957
|
content: toolRequestChunkSchema,
|
|
@@ -23994,6 +24002,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
23994
24002
|
},
|
|
23995
24003
|
role: "agent"
|
|
23996
24004
|
};
|
|
24005
|
+
case "endOfStream":
|
|
24006
|
+
return {
|
|
24007
|
+
...sharedProperties,
|
|
24008
|
+
content: {
|
|
24009
|
+
chunkType: "endOfStream"
|
|
24010
|
+
},
|
|
24011
|
+
role: "agent"
|
|
24012
|
+
};
|
|
23997
24013
|
case "model":
|
|
23998
24014
|
return {
|
|
23999
24015
|
...sharedProperties,
|
|
@@ -26042,6 +26058,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
26042
26058
|
}
|
|
26043
26059
|
function applyChatEventToConversationExchange(conversationExchange, chatEvent) {
|
|
26044
26060
|
switch (chatEvent.content.chunkType) {
|
|
26061
|
+
case "endOfStream": {
|
|
26062
|
+
for (const [, toolCall] of conversationExchange.toolCalls) {
|
|
26063
|
+
if (!toolCall.result) {
|
|
26064
|
+
toolCall.state = "canceled";
|
|
26065
|
+
}
|
|
26066
|
+
}
|
|
26067
|
+
break;
|
|
26068
|
+
}
|
|
26045
26069
|
case "error":
|
|
26046
26070
|
case "model":
|
|
26047
26071
|
case "userMessage": {
|
|
@@ -30950,6 +30974,7 @@ ${err.message}`);
|
|
|
30950
30974
|
},
|
|
30951
30975
|
types: {
|
|
30952
30976
|
context: {},
|
|
30977
|
+
emitted: {},
|
|
30953
30978
|
events: {},
|
|
30954
30979
|
input: {}
|
|
30955
30980
|
}
|
|
@@ -30971,21 +30996,27 @@ ${err.message}`);
|
|
|
30971
30996
|
}),
|
|
30972
30997
|
onDone: [
|
|
30973
30998
|
{
|
|
30974
|
-
actions:
|
|
30975
|
-
|
|
30976
|
-
|
|
30977
|
-
|
|
30978
|
-
|
|
30979
|
-
|
|
30980
|
-
|
|
30981
|
-
|
|
30982
|
-
|
|
30983
|
-
|
|
30984
|
-
|
|
30985
|
-
|
|
30986
|
-
|
|
30987
|
-
|
|
30988
|
-
|
|
30999
|
+
actions: [
|
|
31000
|
+
assign({
|
|
31001
|
+
conversationId: ({ event }) => event.output.id,
|
|
31002
|
+
// Add the message attempt into the snapshot manually
|
|
31003
|
+
conversationSnapshot: ({ context: context2, event }) => [
|
|
31004
|
+
...context2.conversationSnapshot ?? [],
|
|
31005
|
+
{
|
|
31006
|
+
id: event.output.currentRunId,
|
|
31007
|
+
messages: /* @__PURE__ */ new Map(),
|
|
31008
|
+
submittedUserMessage: context2.messageAttempt,
|
|
31009
|
+
toolCalls: /* @__PURE__ */ new Map()
|
|
31010
|
+
}
|
|
31011
|
+
],
|
|
31012
|
+
currentRunId: ({ event }) => event.output.currentRunId,
|
|
31013
|
+
messageAttempt: void 0
|
|
31014
|
+
}),
|
|
31015
|
+
emit(({ event }) => ({
|
|
31016
|
+
id: event.output.id,
|
|
31017
|
+
type: "conversationCreated"
|
|
31018
|
+
}))
|
|
31019
|
+
],
|
|
30989
31020
|
// Don't transition to streaming in a situation where we didn't receive a currentRunId
|
|
30990
31021
|
guard: ({ event }) => !!event.output.currentRunId,
|
|
30991
31022
|
target: "streaming"
|
|
@@ -31091,16 +31122,19 @@ ${err.message}`);
|
|
|
31091
31122
|
target: "idle"
|
|
31092
31123
|
},
|
|
31093
31124
|
onSnapshot: {
|
|
31094
|
-
actions:
|
|
31095
|
-
|
|
31096
|
-
|
|
31097
|
-
|
|
31098
|
-
return context2.conversationSnapshot;
|
|
31099
|
-
}
|
|
31100
|
-
return AgentConversation.reduceChatEvents(context2.conversationSnapshot, [
|
|
31101
|
-
chatEvent
|
|
31102
|
-
]);
|
|
31125
|
+
actions: enqueueActions(({ context: context2, enqueue, event }) => {
|
|
31126
|
+
const chatEvent = event.snapshot.context;
|
|
31127
|
+
if (!chatEvent) {
|
|
31128
|
+
return;
|
|
31103
31129
|
}
|
|
31130
|
+
const nextSnapshot = AgentConversation.reduceChatEvents(context2.conversationSnapshot, [chatEvent]);
|
|
31131
|
+
enqueue.assign({
|
|
31132
|
+
conversationSnapshot: nextSnapshot
|
|
31133
|
+
});
|
|
31134
|
+
enqueue.emit({
|
|
31135
|
+
chatEvent,
|
|
31136
|
+
type: "chatEventReceived"
|
|
31137
|
+
});
|
|
31104
31138
|
})
|
|
31105
31139
|
},
|
|
31106
31140
|
src: "streamRun"
|
package/dist-iife/enterprise.js
CHANGED
|
@@ -24945,6 +24945,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
24945
24945
|
summary: optional(string2()),
|
|
24946
24946
|
title: optional(string2())
|
|
24947
24947
|
});
|
|
24948
|
+
var endOfStreamChunkSchema = object({
|
|
24949
|
+
chunkType: literal("endOfStream")
|
|
24950
|
+
});
|
|
24948
24951
|
var modelChunkSchema = object({
|
|
24949
24952
|
chunkType: literal("model"),
|
|
24950
24953
|
name: string2().check(_trim(), _minLength(1)),
|
|
@@ -24983,6 +24986,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
24983
24986
|
]);
|
|
24984
24987
|
var chatEventInputSchema = discriminatedUnion("chunkType", [
|
|
24985
24988
|
errorChunkSchema,
|
|
24989
|
+
extend2(endOfStreamChunkSchema, chatEventSharedSchema),
|
|
24986
24990
|
extend2(conversationUpdateChunkSchema, chatEventSharedSchema),
|
|
24987
24991
|
extend2(modelChunkSchema, chatEventSharedSchema),
|
|
24988
24992
|
extend2(toolRequestChunkSchema, chatEventSharedSchema),
|
|
@@ -24999,6 +25003,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
24999
25003
|
role: literal("agent")
|
|
25000
25004
|
}),
|
|
25001
25005
|
extend2(chatEventOutputSharedSchema, { content: errorChunkSchema, role: literal("agent") }),
|
|
25006
|
+
extend2(chatEventOutputSharedSchema, {
|
|
25007
|
+
content: endOfStreamChunkSchema,
|
|
25008
|
+
role: literal("agent")
|
|
25009
|
+
}),
|
|
25002
25010
|
extend2(chatEventOutputSharedSchema, { content: modelChunkSchema, role: literal("agent") }),
|
|
25003
25011
|
extend2(chatEventOutputSharedSchema, {
|
|
25004
25012
|
content: toolRequestChunkSchema,
|
|
@@ -25049,6 +25057,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
25049
25057
|
},
|
|
25050
25058
|
role: "agent"
|
|
25051
25059
|
};
|
|
25060
|
+
case "endOfStream":
|
|
25061
|
+
return {
|
|
25062
|
+
...sharedProperties,
|
|
25063
|
+
content: {
|
|
25064
|
+
chunkType: "endOfStream"
|
|
25065
|
+
},
|
|
25066
|
+
role: "agent"
|
|
25067
|
+
};
|
|
25052
25068
|
case "model":
|
|
25053
25069
|
return {
|
|
25054
25070
|
...sharedProperties,
|
|
@@ -26748,6 +26764,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
26748
26764
|
}
|
|
26749
26765
|
function applyChatEventToConversationExchange(conversationExchange, chatEvent) {
|
|
26750
26766
|
switch (chatEvent.content.chunkType) {
|
|
26767
|
+
case "endOfStream": {
|
|
26768
|
+
for (const [, toolCall] of conversationExchange.toolCalls) {
|
|
26769
|
+
if (!toolCall.result) {
|
|
26770
|
+
toolCall.state = "canceled";
|
|
26771
|
+
}
|
|
26772
|
+
}
|
|
26773
|
+
break;
|
|
26774
|
+
}
|
|
26751
26775
|
case "error":
|
|
26752
26776
|
case "model":
|
|
26753
26777
|
case "userMessage": {
|
|
@@ -31656,6 +31680,7 @@ ${err.message}`);
|
|
|
31656
31680
|
},
|
|
31657
31681
|
types: {
|
|
31658
31682
|
context: {},
|
|
31683
|
+
emitted: {},
|
|
31659
31684
|
events: {},
|
|
31660
31685
|
input: {}
|
|
31661
31686
|
}
|
|
@@ -31677,21 +31702,27 @@ ${err.message}`);
|
|
|
31677
31702
|
}),
|
|
31678
31703
|
onDone: [
|
|
31679
31704
|
{
|
|
31680
|
-
actions:
|
|
31681
|
-
|
|
31682
|
-
|
|
31683
|
-
|
|
31684
|
-
|
|
31685
|
-
|
|
31686
|
-
|
|
31687
|
-
|
|
31688
|
-
|
|
31689
|
-
|
|
31690
|
-
|
|
31691
|
-
|
|
31692
|
-
|
|
31693
|
-
|
|
31694
|
-
|
|
31705
|
+
actions: [
|
|
31706
|
+
assign({
|
|
31707
|
+
conversationId: ({ event }) => event.output.id,
|
|
31708
|
+
// Add the message attempt into the snapshot manually
|
|
31709
|
+
conversationSnapshot: ({ context: context2, event }) => [
|
|
31710
|
+
...context2.conversationSnapshot ?? [],
|
|
31711
|
+
{
|
|
31712
|
+
id: event.output.currentRunId,
|
|
31713
|
+
messages: /* @__PURE__ */ new Map(),
|
|
31714
|
+
submittedUserMessage: context2.messageAttempt,
|
|
31715
|
+
toolCalls: /* @__PURE__ */ new Map()
|
|
31716
|
+
}
|
|
31717
|
+
],
|
|
31718
|
+
currentRunId: ({ event }) => event.output.currentRunId,
|
|
31719
|
+
messageAttempt: void 0
|
|
31720
|
+
}),
|
|
31721
|
+
emit(({ event }) => ({
|
|
31722
|
+
id: event.output.id,
|
|
31723
|
+
type: "conversationCreated"
|
|
31724
|
+
}))
|
|
31725
|
+
],
|
|
31695
31726
|
// Don't transition to streaming in a situation where we didn't receive a currentRunId
|
|
31696
31727
|
guard: ({ event }) => !!event.output.currentRunId,
|
|
31697
31728
|
target: "streaming"
|
|
@@ -31797,16 +31828,19 @@ ${err.message}`);
|
|
|
31797
31828
|
target: "idle"
|
|
31798
31829
|
},
|
|
31799
31830
|
onSnapshot: {
|
|
31800
|
-
actions:
|
|
31801
|
-
|
|
31802
|
-
|
|
31803
|
-
|
|
31804
|
-
return context2.conversationSnapshot;
|
|
31805
|
-
}
|
|
31806
|
-
return AgentConversation.reduceChatEvents(context2.conversationSnapshot, [
|
|
31807
|
-
chatEvent
|
|
31808
|
-
]);
|
|
31831
|
+
actions: enqueueActions(({ context: context2, enqueue, event }) => {
|
|
31832
|
+
const chatEvent = event.snapshot.context;
|
|
31833
|
+
if (!chatEvent) {
|
|
31834
|
+
return;
|
|
31809
31835
|
}
|
|
31836
|
+
const nextSnapshot = AgentConversation.reduceChatEvents(context2.conversationSnapshot, [chatEvent]);
|
|
31837
|
+
enqueue.assign({
|
|
31838
|
+
conversationSnapshot: nextSnapshot
|
|
31839
|
+
});
|
|
31840
|
+
enqueue.emit({
|
|
31841
|
+
chatEvent,
|
|
31842
|
+
type: "chatEventReceived"
|
|
31843
|
+
});
|
|
31810
31844
|
})
|
|
31811
31845
|
},
|
|
31812
31846
|
src: "streamRun"
|