@deepagents/text2sql 0.38.0 → 0.39.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.
@@ -1 +1 @@
1
- {"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../../../../src/lib/adapters/postgres/postgres.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,eAAe,EACpB,KAAK,WAAW,EAKhB,KAAK,gBAAgB,EACtB,MAAM,eAAe,CAAC;AAEvB,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,SAAS,EAAE,WAAW,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAwEF,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;;;;;EA0B9D;AAED,qBAAa,QAAS,SAAQ,OAAO;;IAEnC,SAAkB,SAAS,EAAE,WAAW,EAAE,CAAC;IAC3C,SAAkB,aAAa,YAAY;IAC3C,SAAkB,aAAa,WAAwC;IACvE,SAAkB,iBAAiB,gBAAgB;gBAEvC,OAAO,EAAE,sBAAsB;IAY5B,WAAW,CAAC,GAAG,EAAE,MAAM;IAIvB,YAAY,CAAC,GAAG,EAAE,MAAM;IAcxB,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAIhD,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIrC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAI7B,oBAAoB,CAC3B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,EAC7B,KAAK,EAAE,MAAM,GACZ,MAAM;CAgdV"}
1
+ {"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../../../../src/lib/adapters/postgres/postgres.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,eAAe,EACpB,KAAK,WAAW,EAKhB,KAAK,gBAAgB,EACtB,MAAM,eAAe,CAAC;AAEvB,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,SAAS,EAAE,WAAW,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAyEF,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;;;;;EA0B9D;AAED,qBAAa,QAAS,SAAQ,OAAO;;IAEnC,SAAkB,SAAS,EAAE,WAAW,EAAE,CAAC;IAC3C,SAAkB,aAAa,YAAY;IAC3C,SAAkB,aAAa,WAAwC;IACvE,SAAkB,iBAAiB,gBAAgB;gBAEvC,OAAO,EAAE,sBAAsB;IAY5B,WAAW,CAAC,GAAG,EAAE,MAAM;IAIvB,YAAY,CAAC,GAAG,EAAE,MAAM;IAcxB,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAIhD,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIrC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAI7B,oBAAoB,CAC3B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,EAC7B,KAAK,EAAE,MAAM,GACZ,MAAM;CAsdV"}
@@ -148,6 +148,17 @@ function relationship(input) {
148
148
  }
149
149
 
150
150
  // packages/text2sql/src/lib/adapters/groundings/context.ts
151
+ var noopProgress = () => {
152
+ };
153
+ function timestampProgress(onProgress) {
154
+ if (!onProgress) return noopProgress;
155
+ return (progress) => {
156
+ onProgress({
157
+ ...progress,
158
+ timestampMs: progress.timestampMs ?? Date.now()
159
+ });
160
+ };
161
+ }
151
162
  function createGroundingContext(options = {}) {
152
163
  return {
153
164
  tables: [],
@@ -155,7 +166,7 @@ function createGroundingContext(options = {}) {
155
166
  relationships: [],
156
167
  info: void 0,
157
168
  cache: /* @__PURE__ */ new Map(),
158
- onProgress: options.onProgress
169
+ onProgress: timestampProgress(options.onProgress)
159
170
  };
160
171
  }
161
172
 
@@ -302,7 +313,7 @@ var Adapter = class {
302
313
  for (const fn of this.grounding) {
303
314
  const grounding = fn(this);
304
315
  if (grounding.phase) {
305
- ctx.onProgress?.({
316
+ ctx.onProgress({
306
317
  type: "phase:start",
307
318
  phase: grounding.phase,
308
319
  message: `Starting ${grounding.name} introspection...`
@@ -312,7 +323,7 @@ var Adapter = class {
312
323
  await grounding.execute(ctx);
313
324
  } finally {
314
325
  if (grounding.phase) {
315
- ctx.onProgress?.({
326
+ ctx.onProgress({
316
327
  type: "phase:end",
317
328
  phase: grounding.phase,
318
329
  message: `Finished ${grounding.name} introspection.`
@@ -694,7 +705,7 @@ var ColumnStatsGrounding = class extends AbstractGrounding {
694
705
  const total = allContainers.length;
695
706
  for (let i = 0; i < allContainers.length; i++) {
696
707
  const container = allContainers[i];
697
- ctx.onProgress?.({
708
+ ctx.onProgress({
698
709
  type: "phase:progress",
699
710
  phase: "column_stats",
700
711
  table: container.name,
@@ -812,7 +823,7 @@ var ColumnValuesGrounding = class extends AbstractGrounding {
812
823
  const total = allContainers.length;
813
824
  for (let i = 0; i < allContainers.length; i++) {
814
825
  const container = allContainers[i];
815
- ctx.onProgress?.({
826
+ ctx.onProgress({
816
827
  type: "phase:progress",
817
828
  phase: "column_values",
818
829
  table: container.name,
@@ -897,7 +908,7 @@ var RowCountGrounding = class extends AbstractGrounding {
897
908
  const total = ctx.tables.length;
898
909
  for (let i = 0; i < ctx.tables.length; i++) {
899
910
  const table2 = ctx.tables[i];
900
- ctx.onProgress?.({
911
+ ctx.onProgress({
901
912
  type: "phase:progress",
902
913
  phase: "row_counts",
903
914
  table: table2.name,
@@ -948,7 +959,7 @@ var TableGrounding = class extends AbstractGrounding {
948
959
  if (!forward && !backward) {
949
960
  const tables3 = await Promise.all(
950
961
  seedTables.map(async (name, index2) => {
951
- ctx.onProgress?.({
962
+ ctx.onProgress({
952
963
  type: "phase:progress",
953
964
  phase: "tables",
954
965
  table: name,
@@ -983,7 +994,7 @@ var TableGrounding = class extends AbstractGrounding {
983
994
  forwardVisited.add(name);
984
995
  if (!tables2[name]) {
985
996
  loadedCount++;
986
- ctx.onProgress?.({
997
+ ctx.onProgress({
987
998
  type: "phase:progress",
988
999
  phase: "tables",
989
1000
  table: name,
@@ -1015,7 +1026,7 @@ var TableGrounding = class extends AbstractGrounding {
1015
1026
  backwardVisited.add(name);
1016
1027
  if (!tables2[name]) {
1017
1028
  loadedCount++;
1018
- ctx.onProgress?.({
1029
+ ctx.onProgress({
1019
1030
  type: "phase:progress",
1020
1031
  phase: "tables",
1021
1032
  table: name,