@dremio/js-sdk 0.62.1 → 0.63.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.
@@ -3323,6 +3323,7 @@ var DremioEnterprise = (() => {
3323
3323
  createConversationPromptSchema: () => createConversationPromptSchema,
3324
3324
  fromPat: () => fromPat,
3325
3325
  fromTextEventStream: () => fromTextEventStream,
3326
+ fromTextEventStreamActivity: () => fromTextEventStreamActivity,
3326
3327
  fromUsernamePassword: () => fromUsernamePassword,
3327
3328
  isToolRequest: () => isToolRequest,
3328
3329
  isToolResult: () => isToolResult
@@ -9842,6 +9843,67 @@ var DremioEnterprise = (() => {
9842
9843
  inst._zod.def = def;
9843
9844
  (_a = inst._zod).onattach ?? (_a.onattach = []);
9844
9845
  });
9846
+ var numericOriginMap = {
9847
+ number: "number",
9848
+ bigint: "bigint",
9849
+ object: "date"
9850
+ };
9851
+ var $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst, def) => {
9852
+ $ZodCheck.init(inst, def);
9853
+ const origin = numericOriginMap[typeof def.value];
9854
+ inst._zod.onattach.push((inst2) => {
9855
+ const bag = inst2._zod.bag;
9856
+ const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
9857
+ if (def.value < curr) {
9858
+ if (def.inclusive)
9859
+ bag.maximum = def.value;
9860
+ else
9861
+ bag.exclusiveMaximum = def.value;
9862
+ }
9863
+ });
9864
+ inst._zod.check = (payload) => {
9865
+ if (def.inclusive ? payload.value <= def.value : payload.value < def.value) {
9866
+ return;
9867
+ }
9868
+ payload.issues.push({
9869
+ origin,
9870
+ code: "too_big",
9871
+ maximum: def.value,
9872
+ input: payload.value,
9873
+ inclusive: def.inclusive,
9874
+ inst,
9875
+ continue: !def.abort
9876
+ });
9877
+ };
9878
+ });
9879
+ var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan", (inst, def) => {
9880
+ $ZodCheck.init(inst, def);
9881
+ const origin = numericOriginMap[typeof def.value];
9882
+ inst._zod.onattach.push((inst2) => {
9883
+ const bag = inst2._zod.bag;
9884
+ const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
9885
+ if (def.value > curr) {
9886
+ if (def.inclusive)
9887
+ bag.minimum = def.value;
9888
+ else
9889
+ bag.exclusiveMinimum = def.value;
9890
+ }
9891
+ });
9892
+ inst._zod.check = (payload) => {
9893
+ if (def.inclusive ? payload.value >= def.value : payload.value > def.value) {
9894
+ return;
9895
+ }
9896
+ payload.issues.push({
9897
+ origin,
9898
+ code: "too_small",
9899
+ minimum: def.value,
9900
+ input: payload.value,
9901
+ inclusive: def.inclusive,
9902
+ inst,
9903
+ continue: !def.abort
9904
+ });
9905
+ };
9906
+ });
9845
9907
  var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, def) => {
9846
9908
  var _a;
9847
9909
  $ZodCheck.init(inst, def);
@@ -10946,6 +11008,22 @@ var DremioEnterprise = (() => {
10946
11008
  ...normalizeParams(params)
10947
11009
  });
10948
11010
  }
11011
+ function _lte(value, params) {
11012
+ return new $ZodCheckLessThan({
11013
+ check: "less_than",
11014
+ ...normalizeParams(params),
11015
+ value,
11016
+ inclusive: true
11017
+ });
11018
+ }
11019
+ function _gte(value, params) {
11020
+ return new $ZodCheckGreaterThan({
11021
+ check: "greater_than",
11022
+ ...normalizeParams(params),
11023
+ value,
11024
+ inclusive: true
11025
+ });
11026
+ }
10949
11027
  function _minSize(minimum, params) {
10950
11028
  return new $ZodCheckMinSize({
10951
11029
  check: "min_size",
@@ -13652,6 +13730,16 @@ var DremioEnterprise = (() => {
13652
13730
  });
13653
13731
  }
13654
13732
 
13733
+ // node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/dist/esm5/internal/operators/filter.js
13734
+ function filter(predicate, thisArg) {
13735
+ return operate(function(source, subscriber) {
13736
+ var index = 0;
13737
+ source.subscribe(createOperatorSubscriber(subscriber, function(value) {
13738
+ return predicate.call(thisArg, value, index++) && subscriber.next(value);
13739
+ }));
13740
+ });
13741
+ }
13742
+
13655
13743
  // node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/dist/esm5/internal/operators/catchError.js
13656
13744
  function catchError(selector) {
13657
13745
  return operate(function(source, subscriber) {
@@ -14183,29 +14271,29 @@ var DremioEnterprise = (() => {
14183
14271
  user: set(string2().check(_trim(), _minLength(1)))
14184
14272
  }));
14185
14273
  function mapParams(params) {
14186
- const filter = [];
14274
+ const filter2 = [];
14187
14275
  if (params.contains) {
14188
- filter.push(`*=contains=${JSON.stringify(params.contains)}`);
14276
+ filter2.push(`*=contains=${JSON.stringify(params.contains)}`);
14189
14277
  }
14190
14278
  if (params.queryType?.size) {
14191
- filter.push(`(${Array.from(params.queryType).map((v2) => `qt=="${v2}"`).join(",")})`);
14279
+ filter2.push(`(${Array.from(params.queryType).map((v2) => `qt=="${v2}"`).join(",")})`);
14192
14280
  }
14193
14281
  if (params.status?.size) {
14194
- filter.push(`(${Array.from(params.status).map((v2) => `jst=="${v2}"`).join(",")})`);
14282
+ filter2.push(`(${Array.from(params.status).map((v2) => `jst=="${v2}"`).join(",")})`);
14195
14283
  }
14196
14284
  if (params.user?.size) {
14197
- filter.push(`(${Array.from(params.user).map((v2) => `usr=="${v2}"`).join(",")})`);
14285
+ filter2.push(`(${Array.from(params.user).map((v2) => `usr=="${v2}"`).join(",")})`);
14198
14286
  }
14199
14287
  if (params.dateRange?.start) {
14200
14288
  const { end, start } = params.dateRange;
14201
- filter.push(`(${[
14289
+ filter2.push(`(${[
14202
14290
  start && `st=gt=${start.epochMilliseconds}`,
14203
14291
  end && `st=lt=${end.epochMilliseconds}`
14204
14292
  ].join(";")})`);
14205
14293
  }
14206
14294
  return {
14207
14295
  detailLevel: "1",
14208
- filter,
14296
+ filter: filter2,
14209
14297
  order: params.sort ? params.sort.direction === "DESC" ? "DESCENDING" : "ASCENDING" : void 0,
14210
14298
  sort: params.sort ? fieldToV2Mapping[params.sort.field] : void 0
14211
14299
  };
@@ -15973,7 +16061,8 @@ var DremioEnterprise = (() => {
15973
16061
  };
15974
16062
 
15975
16063
  // dist/common/fromTextEventStream.js
15976
- var fromTextEventStream = (input) => new Observable((subscriber) => {
16064
+ var fromTextEventStream = (input) => fromTextEventStreamActivity(input).pipe(filter((activity) => activity.type === "event"), map((activity) => activity.event));
16065
+ var fromTextEventStreamActivity = (input) => new Observable((subscriber) => {
15977
16066
  const controller = new AbortController();
15978
16067
  const { signal } = controller;
15979
16068
  input({ signal }).then(async (response) => {
@@ -15986,7 +16075,13 @@ var DremioEnterprise = (() => {
15986
16075
  if (!response.body) {
15987
16076
  throw new Error(`Response body was undefined`);
15988
16077
  }
15989
- return response.body.pipeThrough(new TextDecoderStream()).pipeThrough(new EventSourceParserStream());
16078
+ return response.body.pipeThrough(new TextDecoderStream()).pipeThrough(new EventSourceParserStream({
16079
+ onComment(comment) {
16080
+ if (!signal.aborted) {
16081
+ subscriber.next({ comment, type: "comment" });
16082
+ }
16083
+ }
16084
+ }));
15990
16085
  }).then(async (readableStream) => {
15991
16086
  const reader = readableStream.getReader();
15992
16087
  while (!signal.aborted) {
@@ -15998,7 +16093,7 @@ var DremioEnterprise = (() => {
15998
16093
  subscriber.complete();
15999
16094
  break;
16000
16095
  }
16001
- subscriber.next(value);
16096
+ subscriber.next({ event: value, type: "event" });
16002
16097
  }
16003
16098
  await reader.cancel();
16004
16099
  }).catch((e2) => {
@@ -16170,6 +16265,10 @@ var DremioEnterprise = (() => {
16170
16265
  toolExecutionId: string2(),
16171
16266
  toolName: string2()
16172
16267
  });
16268
+ var contextUsageChunkSchema = object({
16269
+ chunkType: literal("contextUsage"),
16270
+ contextUsagePercentage: number2().check(_gte(0), _lte(100))
16271
+ });
16173
16272
  var selectedSkillInfoSchema = object({
16174
16273
  id: string2(),
16175
16274
  name: string2()
@@ -16192,6 +16291,7 @@ var DremioEnterprise = (() => {
16192
16291
  extend2(errorChunkV2Schema, chatEventSharedSchema),
16193
16292
  endOfStreamInputSchema,
16194
16293
  extend2(interruptChunkSchema, chatEventSharedSchema),
16294
+ extend2(contextUsageChunkSchema, chatEventSharedSchema),
16195
16295
  extend2(conversationUpdateChunkSchema, chatEventSharedSchema),
16196
16296
  extend2(jobUpdateChunkSchema, chatEventSharedSchema),
16197
16297
  extend2(modelChunkSchema, chatEventSharedSchema),
@@ -16221,6 +16321,10 @@ var DremioEnterprise = (() => {
16221
16321
  content: interruptChunkSchema,
16222
16322
  role: literal("agent")
16223
16323
  }),
16324
+ extend2(chatEventOutputSharedSchema, {
16325
+ content: contextUsageChunkSchema,
16326
+ role: literal("agent")
16327
+ }),
16224
16328
  extend2(chatEventOutputSharedSchema, {
16225
16329
  content: jobUpdateChunkSchema,
16226
16330
  role: literal("agent")
@@ -16273,6 +16377,15 @@ var DremioEnterprise = (() => {
16273
16377
  runId: v2.runId
16274
16378
  };
16275
16379
  switch (v2.chunkType) {
16380
+ case "contextUsage":
16381
+ return {
16382
+ ...sharedProperties,
16383
+ content: {
16384
+ chunkType: "contextUsage",
16385
+ contextUsagePercentage: v2.contextUsagePercentage
16386
+ },
16387
+ role: "agent"
16388
+ };
16276
16389
  case "conversationUpdate":
16277
16390
  return {
16278
16391
  ...sharedProperties,
@@ -21664,7 +21777,7 @@ ${err.message}`);
21664
21777
 
21665
21778
  // dist/enterprise/ai/conversations/createConversationMachine.js
21666
21779
  var RETRIEVE_STATE_TIMEOUT_MS = 1e4;
21667
- var STREAM_IDLE_TIMEOUT_MS = 6e4;
21780
+ var STREAM_IDLE_TIMEOUT_MS = 15e3;
21668
21781
  var STREAM_RETRY_DELAY_MS = 2500;
21669
21782
  var MAX_STREAM_RETRIES = 5;
21670
21783
  var STREAM_STATE_RESET = {
@@ -21724,7 +21837,7 @@ ${err.message}`);
21724
21837
  }
21725
21838
  return result.value;
21726
21839
  })),
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 })))
21840
+ streamRun: fromObservable(({ input }) => fromTextEventStreamActivity(({ signal }) => streamRunEvents(config3)({ conversationId: input.conversationId, runId: input.runId }, { signal })).pipe(timeout({ each: STREAM_IDLE_TIMEOUT_MS }), filter((activity) => activity.type === "event"), map(({ event }) => decode(chatEventCodec, JSON.parse(event.data)))))
21728
21841
  },
21729
21842
  delays: {
21730
21843
  STREAM_RETRY_DELAY: STREAM_RETRY_DELAY_MS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dremio/js-sdk",
3
- "version": "0.62.1",
3
+ "version": "0.63.0",
4
4
  "description": "JavaScript library for the Dremio API",
5
5
  "keywords": [
6
6
  "dremio",