@dremio/js-sdk 0.62.1 → 0.64.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.
@@ -3298,6 +3298,7 @@ var DremioCommunity = (() => {
3298
3298
  TagVersionReference: () => TagVersionReference,
3299
3299
  ValidationProblem: () => ValidationProblem,
3300
3300
  fromTextEventStream: () => fromTextEventStream,
3301
+ fromTextEventStreamActivity: () => fromTextEventStreamActivity,
3301
3302
  fromUsernamePassword: () => fromUsernamePassword
3302
3303
  });
3303
3304
 
@@ -10539,6 +10540,16 @@ var DremioCommunity = (() => {
10539
10540
  });
10540
10541
  }
10541
10542
 
10543
+ // node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/dist/esm5/internal/operators/filter.js
10544
+ function filter(predicate, thisArg) {
10545
+ return operate(function(source, subscriber) {
10546
+ var index = 0;
10547
+ source.subscribe(createOperatorSubscriber(subscriber, function(value) {
10548
+ return predicate.call(thisArg, value, index++) && subscriber.next(value);
10549
+ }));
10550
+ });
10551
+ }
10552
+
10542
10553
  // node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/dist/esm5/internal/operators/repeat.js
10543
10554
  function repeat(countOrConfig) {
10544
10555
  var _a;
@@ -12825,29 +12836,29 @@ var DremioCommunity = (() => {
12825
12836
  user: set(string2().check(_trim(), _minLength(1)))
12826
12837
  }));
12827
12838
  function mapParams(params) {
12828
- const filter = [];
12839
+ const filter2 = [];
12829
12840
  if (params.contains) {
12830
- filter.push(`*=contains=${JSON.stringify(params.contains)}`);
12841
+ filter2.push(`*=contains=${JSON.stringify(params.contains)}`);
12831
12842
  }
12832
12843
  if (params.queryType?.size) {
12833
- filter.push(`(${Array.from(params.queryType).map((v2) => `qt=="${v2}"`).join(",")})`);
12844
+ filter2.push(`(${Array.from(params.queryType).map((v2) => `qt=="${v2}"`).join(",")})`);
12834
12845
  }
12835
12846
  if (params.status?.size) {
12836
- filter.push(`(${Array.from(params.status).map((v2) => `jst=="${v2}"`).join(",")})`);
12847
+ filter2.push(`(${Array.from(params.status).map((v2) => `jst=="${v2}"`).join(",")})`);
12837
12848
  }
12838
12849
  if (params.user?.size) {
12839
- filter.push(`(${Array.from(params.user).map((v2) => `usr=="${v2}"`).join(",")})`);
12850
+ filter2.push(`(${Array.from(params.user).map((v2) => `usr=="${v2}"`).join(",")})`);
12840
12851
  }
12841
12852
  if (params.dateRange?.start) {
12842
12853
  const { end, start } = params.dateRange;
12843
- filter.push(`(${[
12854
+ filter2.push(`(${[
12844
12855
  start && `st=gt=${start.epochMilliseconds}`,
12845
12856
  end && `st=lt=${end.epochMilliseconds}`
12846
12857
  ].join(";")})`);
12847
12858
  }
12848
12859
  return {
12849
12860
  detailLevel: "1",
12850
- filter,
12861
+ filter: filter2,
12851
12862
  order: params.sort ? params.sort.direction === "DESC" ? "DESCENDING" : "ASCENDING" : void 0,
12852
12863
  sort: params.sort ? fieldToV2Mapping[params.sort.field] : void 0
12853
12864
  };
@@ -13693,7 +13704,8 @@ var DremioCommunity = (() => {
13693
13704
  };
13694
13705
 
13695
13706
  // dist/common/fromTextEventStream.js
13696
- var fromTextEventStream = (input) => new Observable((subscriber) => {
13707
+ var fromTextEventStream = (input) => fromTextEventStreamActivity(input).pipe(filter((activity) => activity.type === "event"), map((activity) => activity.event));
13708
+ var fromTextEventStreamActivity = (input) => new Observable((subscriber) => {
13697
13709
  const controller = new AbortController();
13698
13710
  const { signal } = controller;
13699
13711
  input({ signal }).then(async (response) => {
@@ -13706,7 +13718,13 @@ var DremioCommunity = (() => {
13706
13718
  if (!response.body) {
13707
13719
  throw new Error(`Response body was undefined`);
13708
13720
  }
13709
- return response.body.pipeThrough(new TextDecoderStream()).pipeThrough(new EventSourceParserStream());
13721
+ return response.body.pipeThrough(new TextDecoderStream()).pipeThrough(new EventSourceParserStream({
13722
+ onComment(comment) {
13723
+ if (!signal.aborted) {
13724
+ subscriber.next({ comment, type: "comment" });
13725
+ }
13726
+ }
13727
+ }));
13710
13728
  }).then(async (readableStream) => {
13711
13729
  const reader = readableStream.getReader();
13712
13730
  while (!signal.aborted) {
@@ -13718,7 +13736,7 @@ var DremioCommunity = (() => {
13718
13736
  subscriber.complete();
13719
13737
  break;
13720
13738
  }
13721
- subscriber.next(value);
13739
+ subscriber.next({ event: value, type: "event" });
13722
13740
  }
13723
13741
  await reader.cancel();
13724
13742
  }).catch((e2) => {
@@ -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,
@@ -16649,6 +16762,7 @@ var DremioEnterprise = (() => {
16649
16762
  }))
16650
16763
  })),
16651
16764
  context: optional(string2()),
16765
+ fileAttachmentIds: optional(array(string2())),
16652
16766
  skillIds: optional(array(string2())),
16653
16767
  text: string2()
16654
16768
  });
@@ -16683,6 +16797,7 @@ var DremioEnterprise = (() => {
16683
16797
  acceptTaskNames: v2.message.prompt?.acceptTaskNames,
16684
16798
  approvals: v2.message.prompt?.approvals,
16685
16799
  context: v2.message.prompt?.context,
16800
+ fileAttachmentIds: v2.message.prompt?.fileAttachmentIds,
16686
16801
  skillIds: v2.message.prompt?.skillIds,
16687
16802
  text: v2.message.content
16688
16803
  }
@@ -16694,6 +16809,7 @@ var DremioEnterprise = (() => {
16694
16809
  acceptTaskNames: v2.prompt?.acceptTaskNames,
16695
16810
  approvals: v2.prompt?.approvals,
16696
16811
  context: v2.prompt?.context,
16812
+ fileAttachmentIds: v2.prompt?.fileAttachmentIds,
16697
16813
  skillIds: v2.prompt?.skillIds
16698
16814
  }),
16699
16815
  modelName: v2.modelName,
@@ -21664,7 +21780,7 @@ ${err.message}`);
21664
21780
 
21665
21781
  // dist/enterprise/ai/conversations/createConversationMachine.js
21666
21782
  var RETRIEVE_STATE_TIMEOUT_MS = 1e4;
21667
- var STREAM_IDLE_TIMEOUT_MS = 6e4;
21783
+ var STREAM_IDLE_TIMEOUT_MS = 15e3;
21668
21784
  var STREAM_RETRY_DELAY_MS = 2500;
21669
21785
  var MAX_STREAM_RETRIES = 5;
21670
21786
  var STREAM_STATE_RESET = {
@@ -21724,7 +21840,7 @@ ${err.message}`);
21724
21840
  }
21725
21841
  return result.value;
21726
21842
  })),
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 })))
21843
+ 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
21844
  },
21729
21845
  delays: {
21730
21846
  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.64.0",
4
4
  "description": "JavaScript library for the Dremio API",
5
5
  "keywords": [
6
6
  "dremio",