@dremio/js-sdk 0.60.0 → 0.62.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 +28 -1
- package/dist/cloud/ai/AIResource.d.ts +90 -0
- package/dist/cloud/projects/Project.d.ts +5 -0
- package/dist/cloud/projects/projectPropertiesCodec.d.ts +15 -0
- package/dist/cloud/projects/projectPropertiesCodec.js +6 -0
- package/dist/cloud/projects/projectPropertiesCodec.js.map +1 -1
- 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 +3 -2
- 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 +181 -12
- package/dist-iife/enterprise.js +175 -12
- package/package.json +1 -1
package/dist-iife/cloud.js
CHANGED
|
@@ -13124,16 +13124,16 @@ var DremioCloud = (() => {
|
|
|
13124
13124
|
|
|
13125
13125
|
// node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js
|
|
13126
13126
|
var timeoutProvider = {
|
|
13127
|
-
setTimeout: function(handler,
|
|
13127
|
+
setTimeout: function(handler, timeout2) {
|
|
13128
13128
|
var args = [];
|
|
13129
13129
|
for (var _i2 = 2; _i2 < arguments.length; _i2++) {
|
|
13130
13130
|
args[_i2 - 2] = arguments[_i2];
|
|
13131
13131
|
}
|
|
13132
13132
|
var delegate = timeoutProvider.delegate;
|
|
13133
13133
|
if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
|
|
13134
|
-
return delegate.setTimeout.apply(delegate, __spreadArray2([handler,
|
|
13134
|
+
return delegate.setTimeout.apply(delegate, __spreadArray2([handler, timeout2], __read(args)));
|
|
13135
13135
|
}
|
|
13136
|
-
return setTimeout.apply(void 0, __spreadArray2([handler,
|
|
13136
|
+
return setTimeout.apply(void 0, __spreadArray2([handler, timeout2], __read(args)));
|
|
13137
13137
|
},
|
|
13138
13138
|
clearTimeout: function(handle) {
|
|
13139
13139
|
var delegate = timeoutProvider.delegate;
|
|
@@ -13802,16 +13802,16 @@ var DremioCloud = (() => {
|
|
|
13802
13802
|
|
|
13803
13803
|
// node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/dist/esm5/internal/scheduler/intervalProvider.js
|
|
13804
13804
|
var intervalProvider = {
|
|
13805
|
-
setInterval: function(handler,
|
|
13805
|
+
setInterval: function(handler, timeout2) {
|
|
13806
13806
|
var args = [];
|
|
13807
13807
|
for (var _i2 = 2; _i2 < arguments.length; _i2++) {
|
|
13808
13808
|
args[_i2 - 2] = arguments[_i2];
|
|
13809
13809
|
}
|
|
13810
13810
|
var delegate = intervalProvider.delegate;
|
|
13811
13811
|
if (delegate === null || delegate === void 0 ? void 0 : delegate.setInterval) {
|
|
13812
|
-
return delegate.setInterval.apply(delegate, __spreadArray2([handler,
|
|
13812
|
+
return delegate.setInterval.apply(delegate, __spreadArray2([handler, timeout2], __read(args)));
|
|
13813
13813
|
}
|
|
13814
|
-
return setInterval.apply(void 0, __spreadArray2([handler,
|
|
13814
|
+
return setInterval.apply(void 0, __spreadArray2([handler, timeout2], __read(args)));
|
|
13815
13815
|
},
|
|
13816
13816
|
clearInterval: function(handle) {
|
|
13817
13817
|
var delegate = intervalProvider.delegate;
|
|
@@ -14426,6 +14426,60 @@ var DremioCloud = (() => {
|
|
|
14426
14426
|
return value instanceof Date && !isNaN(value);
|
|
14427
14427
|
}
|
|
14428
14428
|
|
|
14429
|
+
// node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/dist/esm5/internal/operators/timeout.js
|
|
14430
|
+
var TimeoutError = createErrorClass(function(_super) {
|
|
14431
|
+
return function TimeoutErrorImpl(info) {
|
|
14432
|
+
if (info === void 0) {
|
|
14433
|
+
info = null;
|
|
14434
|
+
}
|
|
14435
|
+
_super(this);
|
|
14436
|
+
this.message = "Timeout has occurred";
|
|
14437
|
+
this.name = "TimeoutError";
|
|
14438
|
+
this.info = info;
|
|
14439
|
+
};
|
|
14440
|
+
});
|
|
14441
|
+
function timeout(config3, schedulerArg) {
|
|
14442
|
+
var _a = isValidDate(config3) ? { first: config3 } : typeof config3 === "number" ? { each: config3 } : config3, first = _a.first, each = _a.each, _b = _a.with, _with = _b === void 0 ? timeoutErrorFactory : _b, _c = _a.scheduler, scheduler = _c === void 0 ? schedulerArg !== null && schedulerArg !== void 0 ? schedulerArg : asyncScheduler : _c, _d = _a.meta, meta = _d === void 0 ? null : _d;
|
|
14443
|
+
if (first == null && each == null) {
|
|
14444
|
+
throw new TypeError("No timeout provided.");
|
|
14445
|
+
}
|
|
14446
|
+
return operate(function(source, subscriber) {
|
|
14447
|
+
var originalSourceSubscription;
|
|
14448
|
+
var timerSubscription;
|
|
14449
|
+
var lastValue = null;
|
|
14450
|
+
var seen = 0;
|
|
14451
|
+
var startTimer = function(delay) {
|
|
14452
|
+
timerSubscription = executeSchedule(subscriber, scheduler, function() {
|
|
14453
|
+
try {
|
|
14454
|
+
originalSourceSubscription.unsubscribe();
|
|
14455
|
+
innerFrom(_with({
|
|
14456
|
+
meta,
|
|
14457
|
+
lastValue,
|
|
14458
|
+
seen
|
|
14459
|
+
})).subscribe(subscriber);
|
|
14460
|
+
} catch (err) {
|
|
14461
|
+
subscriber.error(err);
|
|
14462
|
+
}
|
|
14463
|
+
}, delay);
|
|
14464
|
+
};
|
|
14465
|
+
originalSourceSubscription = source.subscribe(createOperatorSubscriber(subscriber, function(value) {
|
|
14466
|
+
timerSubscription === null || timerSubscription === void 0 ? void 0 : timerSubscription.unsubscribe();
|
|
14467
|
+
seen++;
|
|
14468
|
+
subscriber.next(lastValue = value);
|
|
14469
|
+
each > 0 && startTimer(each);
|
|
14470
|
+
}, void 0, void 0, function() {
|
|
14471
|
+
if (!(timerSubscription === null || timerSubscription === void 0 ? void 0 : timerSubscription.closed)) {
|
|
14472
|
+
timerSubscription === null || timerSubscription === void 0 ? void 0 : timerSubscription.unsubscribe();
|
|
14473
|
+
}
|
|
14474
|
+
lastValue = null;
|
|
14475
|
+
}));
|
|
14476
|
+
!seen && startTimer(first != null ? typeof first === "number" ? first : +first - scheduler.now() : each);
|
|
14477
|
+
});
|
|
14478
|
+
}
|
|
14479
|
+
function timeoutErrorFactory(info) {
|
|
14480
|
+
throw new TimeoutError(info);
|
|
14481
|
+
}
|
|
14482
|
+
|
|
14429
14483
|
// node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/dist/esm5/internal/operators/map.js
|
|
14430
14484
|
function map(project, thisArg) {
|
|
14431
14485
|
return operate(function(source, subscriber) {
|
|
@@ -14927,6 +14981,12 @@ var DremioCloud = (() => {
|
|
|
14927
14981
|
clientSecret: string2(),
|
|
14928
14982
|
tenantId: string2(),
|
|
14929
14983
|
type: literal("AZURE_STORAGE_CLIENT_CREDENTIALS")
|
|
14984
|
+
}),
|
|
14985
|
+
object({
|
|
14986
|
+
clientId: string2(),
|
|
14987
|
+
storageAccountName: string2(),
|
|
14988
|
+
tenantId: string2(),
|
|
14989
|
+
type: literal("AZURE_WORKLOAD_IDENTITY")
|
|
14930
14990
|
})
|
|
14931
14991
|
])),
|
|
14932
14992
|
id: string2(),
|
|
@@ -17191,6 +17251,14 @@ var DremioCloud = (() => {
|
|
|
17191
17251
|
toolExecutionId: string2(),
|
|
17192
17252
|
toolName: string2()
|
|
17193
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
|
+
});
|
|
17194
17262
|
var userMessageChunkSchema = object({
|
|
17195
17263
|
chunkType: literal("userMessage"),
|
|
17196
17264
|
text: string2()
|
|
@@ -17208,6 +17276,7 @@ var DremioCloud = (() => {
|
|
|
17208
17276
|
extend2(conversationUpdateChunkSchema, chatEventSharedSchema),
|
|
17209
17277
|
extend2(jobUpdateChunkSchema, chatEventSharedSchema),
|
|
17210
17278
|
extend2(modelChunkSchema, chatEventSharedSchema),
|
|
17279
|
+
extend2(selectedSkillsChunkSchema, chatEventSharedSchema),
|
|
17211
17280
|
extend2(sandboxProgressChunkSchema, chatEventSharedSchema),
|
|
17212
17281
|
sandboxStdoutChatEventSchema,
|
|
17213
17282
|
extend2(toolRequestChunkSchema, chatEventSharedSchema),
|
|
@@ -17238,6 +17307,10 @@ var DremioCloud = (() => {
|
|
|
17238
17307
|
role: literal("agent")
|
|
17239
17308
|
}),
|
|
17240
17309
|
extend2(chatEventOutputSharedSchema, { content: modelChunkSchema, role: literal("agent") }),
|
|
17310
|
+
extend2(chatEventOutputSharedSchema, {
|
|
17311
|
+
content: selectedSkillsChunkSchema,
|
|
17312
|
+
role: literal("agent")
|
|
17313
|
+
}),
|
|
17241
17314
|
extend2(chatEventOutputSharedSchema, {
|
|
17242
17315
|
content: sandboxProgressChunkSchema,
|
|
17243
17316
|
role: literal("agent")
|
|
@@ -17331,6 +17404,15 @@ var DremioCloud = (() => {
|
|
|
17331
17404
|
},
|
|
17332
17405
|
role: "agent"
|
|
17333
17406
|
};
|
|
17407
|
+
case "selectedSkills":
|
|
17408
|
+
return {
|
|
17409
|
+
...sharedProperties,
|
|
17410
|
+
content: {
|
|
17411
|
+
chunkType: "selectedSkills",
|
|
17412
|
+
selectedSkills: v2.selectedSkills
|
|
17413
|
+
},
|
|
17414
|
+
role: "agent"
|
|
17415
|
+
};
|
|
17334
17416
|
case "sandboxProgress":
|
|
17335
17417
|
return {
|
|
17336
17418
|
...sharedProperties,
|
|
@@ -19397,6 +19479,7 @@ var DremioCloud = (() => {
|
|
|
19397
19479
|
var constructorString = Object.prototype.constructor.toString();
|
|
19398
19480
|
|
|
19399
19481
|
// dist/enterprise/ai/conversations/reduceChatEvents.js
|
|
19482
|
+
var selectedSkillsCursorKey = "__dremioSelectedSkillsCursor";
|
|
19400
19483
|
function applyChatEventToConversation(draft, chatEvent) {
|
|
19401
19484
|
let conversationExchange = draft.findLast((exchange) => exchange.id === chatEvent.runId);
|
|
19402
19485
|
if (!conversationExchange) {
|
|
@@ -19420,6 +19503,10 @@ var DremioCloud = (() => {
|
|
|
19420
19503
|
}
|
|
19421
19504
|
break;
|
|
19422
19505
|
}
|
|
19506
|
+
case "selectedSkills": {
|
|
19507
|
+
applySelectedSkillsMetadata(conversationExchange, chatEvent);
|
|
19508
|
+
break;
|
|
19509
|
+
}
|
|
19423
19510
|
case "error":
|
|
19424
19511
|
case "model":
|
|
19425
19512
|
case "sandboxProgress":
|
|
@@ -19457,6 +19544,87 @@ var DremioCloud = (() => {
|
|
|
19457
19544
|
}
|
|
19458
19545
|
}
|
|
19459
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
|
+
}
|
|
19460
19628
|
function reduceChatEvents(state = [], chatEvents) {
|
|
19461
19629
|
return create(state, (draft) => {
|
|
19462
19630
|
for (const chatEvent of chatEvents) {
|
|
@@ -19948,20 +20116,20 @@ var DremioCloud = (() => {
|
|
|
19948
20116
|
};
|
|
19949
20117
|
const scheduledEventId = createScheduledEventId(source, id);
|
|
19950
20118
|
system._snapshot._scheduledEvents[scheduledEventId] = scheduledEvent;
|
|
19951
|
-
const
|
|
20119
|
+
const timeout2 = clock.setTimeout(() => {
|
|
19952
20120
|
delete timerMap[scheduledEventId];
|
|
19953
20121
|
delete system._snapshot._scheduledEvents[scheduledEventId];
|
|
19954
20122
|
system._relay(source, target, event);
|
|
19955
20123
|
}, delay);
|
|
19956
|
-
timerMap[scheduledEventId] =
|
|
20124
|
+
timerMap[scheduledEventId] = timeout2;
|
|
19957
20125
|
},
|
|
19958
20126
|
cancel: (source, id) => {
|
|
19959
20127
|
const scheduledEventId = createScheduledEventId(source, id);
|
|
19960
|
-
const
|
|
20128
|
+
const timeout2 = timerMap[scheduledEventId];
|
|
19961
20129
|
delete timerMap[scheduledEventId];
|
|
19962
20130
|
delete system._snapshot._scheduledEvents[scheduledEventId];
|
|
19963
|
-
if (
|
|
19964
|
-
clock.clearTimeout(
|
|
20131
|
+
if (timeout2 !== void 0) {
|
|
20132
|
+
clock.clearTimeout(timeout2);
|
|
19965
20133
|
}
|
|
19966
20134
|
},
|
|
19967
20135
|
cancelAll: (actorRef) => {
|
|
@@ -22926,6 +23094,7 @@ ${err.message}`);
|
|
|
22926
23094
|
|
|
22927
23095
|
// dist/enterprise/ai/conversations/createConversationMachine.js
|
|
22928
23096
|
var RETRIEVE_STATE_TIMEOUT_MS = 1e4;
|
|
23097
|
+
var STREAM_IDLE_TIMEOUT_MS = 6e4;
|
|
22929
23098
|
var STREAM_RETRY_DELAY_MS = 2500;
|
|
22930
23099
|
var MAX_STREAM_RETRIES = 5;
|
|
22931
23100
|
var STREAM_STATE_RESET = {
|
|
@@ -22985,7 +23154,7 @@ ${err.message}`);
|
|
|
22985
23154
|
}
|
|
22986
23155
|
return result.value;
|
|
22987
23156
|
})),
|
|
22988
|
-
streamRun: fromObservable(({ input }) => fromTextEventStream(({ signal }) => streamRunEvents(config3)({ conversationId: input.conversationId, runId: input.runId }, { signal })).pipe(map((event) => decode(chatEventCodec, JSON.parse(event.data)))))
|
|
23157
|
+
streamRun: fromObservable(({ input }) => fromTextEventStream(({ signal }) => streamRunEvents(config3)({ conversationId: input.conversationId, runId: input.runId }, { signal })).pipe(map((event) => decode(chatEventCodec, JSON.parse(event.data))), timeout({ each: STREAM_IDLE_TIMEOUT_MS })))
|
|
22989
23158
|
},
|
|
22990
23159
|
delays: {
|
|
22991
23160
|
STREAM_RETRY_DELAY: STREAM_RETRY_DELAY_MS
|
package/dist-iife/enterprise.js
CHANGED
|
@@ -12251,16 +12251,16 @@ var DremioEnterprise = (() => {
|
|
|
12251
12251
|
|
|
12252
12252
|
// node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js
|
|
12253
12253
|
var timeoutProvider = {
|
|
12254
|
-
setTimeout: function(handler,
|
|
12254
|
+
setTimeout: function(handler, timeout2) {
|
|
12255
12255
|
var args = [];
|
|
12256
12256
|
for (var _i2 = 2; _i2 < arguments.length; _i2++) {
|
|
12257
12257
|
args[_i2 - 2] = arguments[_i2];
|
|
12258
12258
|
}
|
|
12259
12259
|
var delegate = timeoutProvider.delegate;
|
|
12260
12260
|
if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
|
|
12261
|
-
return delegate.setTimeout.apply(delegate, __spreadArray2([handler,
|
|
12261
|
+
return delegate.setTimeout.apply(delegate, __spreadArray2([handler, timeout2], __read(args)));
|
|
12262
12262
|
}
|
|
12263
|
-
return setTimeout.apply(void 0, __spreadArray2([handler,
|
|
12263
|
+
return setTimeout.apply(void 0, __spreadArray2([handler, timeout2], __read(args)));
|
|
12264
12264
|
},
|
|
12265
12265
|
clearTimeout: function(handle) {
|
|
12266
12266
|
var delegate = timeoutProvider.delegate;
|
|
@@ -12929,16 +12929,16 @@ var DremioEnterprise = (() => {
|
|
|
12929
12929
|
|
|
12930
12930
|
// node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/dist/esm5/internal/scheduler/intervalProvider.js
|
|
12931
12931
|
var intervalProvider = {
|
|
12932
|
-
setInterval: function(handler,
|
|
12932
|
+
setInterval: function(handler, timeout2) {
|
|
12933
12933
|
var args = [];
|
|
12934
12934
|
for (var _i2 = 2; _i2 < arguments.length; _i2++) {
|
|
12935
12935
|
args[_i2 - 2] = arguments[_i2];
|
|
12936
12936
|
}
|
|
12937
12937
|
var delegate = intervalProvider.delegate;
|
|
12938
12938
|
if (delegate === null || delegate === void 0 ? void 0 : delegate.setInterval) {
|
|
12939
|
-
return delegate.setInterval.apply(delegate, __spreadArray2([handler,
|
|
12939
|
+
return delegate.setInterval.apply(delegate, __spreadArray2([handler, timeout2], __read(args)));
|
|
12940
12940
|
}
|
|
12941
|
-
return setInterval.apply(void 0, __spreadArray2([handler,
|
|
12941
|
+
return setInterval.apply(void 0, __spreadArray2([handler, timeout2], __read(args)));
|
|
12942
12942
|
},
|
|
12943
12943
|
clearInterval: function(handle) {
|
|
12944
12944
|
var delegate = intervalProvider.delegate;
|
|
@@ -13553,6 +13553,60 @@ var DremioEnterprise = (() => {
|
|
|
13553
13553
|
return value instanceof Date && !isNaN(value);
|
|
13554
13554
|
}
|
|
13555
13555
|
|
|
13556
|
+
// node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/dist/esm5/internal/operators/timeout.js
|
|
13557
|
+
var TimeoutError = createErrorClass(function(_super) {
|
|
13558
|
+
return function TimeoutErrorImpl(info) {
|
|
13559
|
+
if (info === void 0) {
|
|
13560
|
+
info = null;
|
|
13561
|
+
}
|
|
13562
|
+
_super(this);
|
|
13563
|
+
this.message = "Timeout has occurred";
|
|
13564
|
+
this.name = "TimeoutError";
|
|
13565
|
+
this.info = info;
|
|
13566
|
+
};
|
|
13567
|
+
});
|
|
13568
|
+
function timeout(config3, schedulerArg) {
|
|
13569
|
+
var _a = isValidDate(config3) ? { first: config3 } : typeof config3 === "number" ? { each: config3 } : config3, first = _a.first, each = _a.each, _b = _a.with, _with = _b === void 0 ? timeoutErrorFactory : _b, _c = _a.scheduler, scheduler = _c === void 0 ? schedulerArg !== null && schedulerArg !== void 0 ? schedulerArg : asyncScheduler : _c, _d = _a.meta, meta = _d === void 0 ? null : _d;
|
|
13570
|
+
if (first == null && each == null) {
|
|
13571
|
+
throw new TypeError("No timeout provided.");
|
|
13572
|
+
}
|
|
13573
|
+
return operate(function(source, subscriber) {
|
|
13574
|
+
var originalSourceSubscription;
|
|
13575
|
+
var timerSubscription;
|
|
13576
|
+
var lastValue = null;
|
|
13577
|
+
var seen = 0;
|
|
13578
|
+
var startTimer = function(delay) {
|
|
13579
|
+
timerSubscription = executeSchedule(subscriber, scheduler, function() {
|
|
13580
|
+
try {
|
|
13581
|
+
originalSourceSubscription.unsubscribe();
|
|
13582
|
+
innerFrom(_with({
|
|
13583
|
+
meta,
|
|
13584
|
+
lastValue,
|
|
13585
|
+
seen
|
|
13586
|
+
})).subscribe(subscriber);
|
|
13587
|
+
} catch (err) {
|
|
13588
|
+
subscriber.error(err);
|
|
13589
|
+
}
|
|
13590
|
+
}, delay);
|
|
13591
|
+
};
|
|
13592
|
+
originalSourceSubscription = source.subscribe(createOperatorSubscriber(subscriber, function(value) {
|
|
13593
|
+
timerSubscription === null || timerSubscription === void 0 ? void 0 : timerSubscription.unsubscribe();
|
|
13594
|
+
seen++;
|
|
13595
|
+
subscriber.next(lastValue = value);
|
|
13596
|
+
each > 0 && startTimer(each);
|
|
13597
|
+
}, void 0, void 0, function() {
|
|
13598
|
+
if (!(timerSubscription === null || timerSubscription === void 0 ? void 0 : timerSubscription.closed)) {
|
|
13599
|
+
timerSubscription === null || timerSubscription === void 0 ? void 0 : timerSubscription.unsubscribe();
|
|
13600
|
+
}
|
|
13601
|
+
lastValue = null;
|
|
13602
|
+
}));
|
|
13603
|
+
!seen && startTimer(first != null ? typeof first === "number" ? first : +first - scheduler.now() : each);
|
|
13604
|
+
});
|
|
13605
|
+
}
|
|
13606
|
+
function timeoutErrorFactory(info) {
|
|
13607
|
+
throw new TimeoutError(info);
|
|
13608
|
+
}
|
|
13609
|
+
|
|
13556
13610
|
// node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/dist/esm5/internal/operators/map.js
|
|
13557
13611
|
function map(project, thisArg) {
|
|
13558
13612
|
return operate(function(source, subscriber) {
|
|
@@ -16116,6 +16170,14 @@ var DremioEnterprise = (() => {
|
|
|
16116
16170
|
toolExecutionId: string2(),
|
|
16117
16171
|
toolName: string2()
|
|
16118
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
|
+
});
|
|
16119
16181
|
var userMessageChunkSchema = object({
|
|
16120
16182
|
chunkType: literal("userMessage"),
|
|
16121
16183
|
text: string2()
|
|
@@ -16133,6 +16195,7 @@ var DremioEnterprise = (() => {
|
|
|
16133
16195
|
extend2(conversationUpdateChunkSchema, chatEventSharedSchema),
|
|
16134
16196
|
extend2(jobUpdateChunkSchema, chatEventSharedSchema),
|
|
16135
16197
|
extend2(modelChunkSchema, chatEventSharedSchema),
|
|
16198
|
+
extend2(selectedSkillsChunkSchema, chatEventSharedSchema),
|
|
16136
16199
|
extend2(sandboxProgressChunkSchema, chatEventSharedSchema),
|
|
16137
16200
|
sandboxStdoutChatEventSchema,
|
|
16138
16201
|
extend2(toolRequestChunkSchema, chatEventSharedSchema),
|
|
@@ -16163,6 +16226,10 @@ var DremioEnterprise = (() => {
|
|
|
16163
16226
|
role: literal("agent")
|
|
16164
16227
|
}),
|
|
16165
16228
|
extend2(chatEventOutputSharedSchema, { content: modelChunkSchema, role: literal("agent") }),
|
|
16229
|
+
extend2(chatEventOutputSharedSchema, {
|
|
16230
|
+
content: selectedSkillsChunkSchema,
|
|
16231
|
+
role: literal("agent")
|
|
16232
|
+
}),
|
|
16166
16233
|
extend2(chatEventOutputSharedSchema, {
|
|
16167
16234
|
content: sandboxProgressChunkSchema,
|
|
16168
16235
|
role: literal("agent")
|
|
@@ -16256,6 +16323,15 @@ var DremioEnterprise = (() => {
|
|
|
16256
16323
|
},
|
|
16257
16324
|
role: "agent"
|
|
16258
16325
|
};
|
|
16326
|
+
case "selectedSkills":
|
|
16327
|
+
return {
|
|
16328
|
+
...sharedProperties,
|
|
16329
|
+
content: {
|
|
16330
|
+
chunkType: "selectedSkills",
|
|
16331
|
+
selectedSkills: v2.selectedSkills
|
|
16332
|
+
},
|
|
16333
|
+
role: "agent"
|
|
16334
|
+
};
|
|
16259
16335
|
case "sandboxProgress":
|
|
16260
16336
|
return {
|
|
16261
16337
|
...sharedProperties,
|
|
@@ -17973,6 +18049,7 @@ var DremioEnterprise = (() => {
|
|
|
17973
18049
|
var constructorString = Object.prototype.constructor.toString();
|
|
17974
18050
|
|
|
17975
18051
|
// dist/enterprise/ai/conversations/reduceChatEvents.js
|
|
18052
|
+
var selectedSkillsCursorKey = "__dremioSelectedSkillsCursor";
|
|
17976
18053
|
function applyChatEventToConversation(draft, chatEvent) {
|
|
17977
18054
|
let conversationExchange = draft.findLast((exchange) => exchange.id === chatEvent.runId);
|
|
17978
18055
|
if (!conversationExchange) {
|
|
@@ -17996,6 +18073,10 @@ var DremioEnterprise = (() => {
|
|
|
17996
18073
|
}
|
|
17997
18074
|
break;
|
|
17998
18075
|
}
|
|
18076
|
+
case "selectedSkills": {
|
|
18077
|
+
applySelectedSkillsMetadata(conversationExchange, chatEvent);
|
|
18078
|
+
break;
|
|
18079
|
+
}
|
|
17999
18080
|
case "error":
|
|
18000
18081
|
case "model":
|
|
18001
18082
|
case "sandboxProgress":
|
|
@@ -18033,6 +18114,87 @@ var DremioEnterprise = (() => {
|
|
|
18033
18114
|
}
|
|
18034
18115
|
}
|
|
18035
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
|
+
}
|
|
18036
18198
|
function reduceChatEvents(state = [], chatEvents) {
|
|
18037
18199
|
return create(state, (draft) => {
|
|
18038
18200
|
for (const chatEvent of chatEvents) {
|
|
@@ -18524,20 +18686,20 @@ var DremioEnterprise = (() => {
|
|
|
18524
18686
|
};
|
|
18525
18687
|
const scheduledEventId = createScheduledEventId(source, id);
|
|
18526
18688
|
system._snapshot._scheduledEvents[scheduledEventId] = scheduledEvent;
|
|
18527
|
-
const
|
|
18689
|
+
const timeout2 = clock.setTimeout(() => {
|
|
18528
18690
|
delete timerMap[scheduledEventId];
|
|
18529
18691
|
delete system._snapshot._scheduledEvents[scheduledEventId];
|
|
18530
18692
|
system._relay(source, target, event);
|
|
18531
18693
|
}, delay);
|
|
18532
|
-
timerMap[scheduledEventId] =
|
|
18694
|
+
timerMap[scheduledEventId] = timeout2;
|
|
18533
18695
|
},
|
|
18534
18696
|
cancel: (source, id) => {
|
|
18535
18697
|
const scheduledEventId = createScheduledEventId(source, id);
|
|
18536
|
-
const
|
|
18698
|
+
const timeout2 = timerMap[scheduledEventId];
|
|
18537
18699
|
delete timerMap[scheduledEventId];
|
|
18538
18700
|
delete system._snapshot._scheduledEvents[scheduledEventId];
|
|
18539
|
-
if (
|
|
18540
|
-
clock.clearTimeout(
|
|
18701
|
+
if (timeout2 !== void 0) {
|
|
18702
|
+
clock.clearTimeout(timeout2);
|
|
18541
18703
|
}
|
|
18542
18704
|
},
|
|
18543
18705
|
cancelAll: (actorRef) => {
|
|
@@ -21502,6 +21664,7 @@ ${err.message}`);
|
|
|
21502
21664
|
|
|
21503
21665
|
// dist/enterprise/ai/conversations/createConversationMachine.js
|
|
21504
21666
|
var RETRIEVE_STATE_TIMEOUT_MS = 1e4;
|
|
21667
|
+
var STREAM_IDLE_TIMEOUT_MS = 6e4;
|
|
21505
21668
|
var STREAM_RETRY_DELAY_MS = 2500;
|
|
21506
21669
|
var MAX_STREAM_RETRIES = 5;
|
|
21507
21670
|
var STREAM_STATE_RESET = {
|
|
@@ -21561,7 +21724,7 @@ ${err.message}`);
|
|
|
21561
21724
|
}
|
|
21562
21725
|
return result.value;
|
|
21563
21726
|
})),
|
|
21564
|
-
streamRun: fromObservable(({ input }) => fromTextEventStream(({ signal }) => streamRunEvents(config3)({ conversationId: input.conversationId, runId: input.runId }, { signal })).pipe(map((event) => decode(chatEventCodec, JSON.parse(event.data)))))
|
|
21727
|
+
streamRun: fromObservable(({ input }) => fromTextEventStream(({ signal }) => streamRunEvents(config3)({ conversationId: input.conversationId, runId: input.runId }, { signal })).pipe(map((event) => decode(chatEventCodec, JSON.parse(event.data))), timeout({ each: STREAM_IDLE_TIMEOUT_MS })))
|
|
21565
21728
|
},
|
|
21566
21729
|
delays: {
|
|
21567
21730
|
STREAM_RETRY_DELAY: STREAM_RETRY_DELAY_MS
|