@okf/ootils 1.41.0 → 1.41.2

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/dist/node.d.mts CHANGED
@@ -495,7 +495,7 @@ declare namespace BASE_BULLMQ_CONFIG {
495
495
  }
496
496
  export { workerConfig_4 as workerConfig };
497
497
  }
498
- namespace AI_AUTO_ANNOTATE_QUEUE {
498
+ namespace AI_AUTO_ANNOTATE_PREP_QUEUE {
499
499
  let id_5: string;
500
500
  export { id_5 as id };
501
501
  export namespace queueConfig_5 {
@@ -535,7 +535,7 @@ declare namespace BASE_BULLMQ_CONFIG {
535
535
  }
536
536
  export { workerConfig_5 as workerConfig };
537
537
  }
538
- namespace AI_AUTO_ANNOTATE_CHUNK_QUEUE {
538
+ namespace AI_AUTO_ANNOTATE_QUEUE {
539
539
  let id_6: string;
540
540
  export { id_6 as id };
541
541
  export namespace queueConfig_6 {
@@ -575,7 +575,7 @@ declare namespace BASE_BULLMQ_CONFIG {
575
575
  }
576
576
  export { workerConfig_6 as workerConfig };
577
577
  }
578
- namespace ANNOS_ELASTIC_SYNC_QUEUE {
578
+ namespace AI_AUTO_ANNOTATE_CHUNK_QUEUE {
579
579
  let id_7: string;
580
580
  export { id_7 as id };
581
581
  export namespace queueConfig_7 {
@@ -615,7 +615,7 @@ declare namespace BASE_BULLMQ_CONFIG {
615
615
  }
616
616
  export { workerConfig_7 as workerConfig };
617
617
  }
618
- namespace CHUNKS_ELASTIC_SYNC_QUEUE {
618
+ namespace ANNOS_ELASTIC_SYNC_QUEUE {
619
619
  let id_8: string;
620
620
  export { id_8 as id };
621
621
  export namespace queueConfig_8 {
@@ -655,7 +655,7 @@ declare namespace BASE_BULLMQ_CONFIG {
655
655
  }
656
656
  export { workerConfig_8 as workerConfig };
657
657
  }
658
- namespace USERS_ELASTIC_SYNC_QUEUE {
658
+ namespace CHUNKS_ELASTIC_SYNC_QUEUE {
659
659
  let id_9: string;
660
660
  export { id_9 as id };
661
661
  export namespace queueConfig_9 {
@@ -695,7 +695,7 @@ declare namespace BASE_BULLMQ_CONFIG {
695
695
  }
696
696
  export { workerConfig_9 as workerConfig };
697
697
  }
698
- namespace CONTENT_ELASTIC_SYNC_QUEUE {
698
+ namespace USERS_ELASTIC_SYNC_QUEUE {
699
699
  let id_10: string;
700
700
  export { id_10 as id };
701
701
  export namespace queueConfig_10 {
@@ -735,7 +735,7 @@ declare namespace BASE_BULLMQ_CONFIG {
735
735
  }
736
736
  export { workerConfig_10 as workerConfig };
737
737
  }
738
- namespace SARVAM_TRANSCRIPTION_QUEUE {
738
+ namespace CONTENT_ELASTIC_SYNC_QUEUE {
739
739
  let id_11: string;
740
740
  export { id_11 as id };
741
741
  export namespace queueConfig_11 {
@@ -775,7 +775,7 @@ declare namespace BASE_BULLMQ_CONFIG {
775
775
  }
776
776
  export { workerConfig_11 as workerConfig };
777
777
  }
778
- namespace INTERCOM_CONVERSATIONS_QUEUE {
778
+ namespace SARVAM_TRANSCRIPTION_QUEUE {
779
779
  let id_12: string;
780
780
  export { id_12 as id };
781
781
  export namespace queueConfig_12 {
@@ -815,7 +815,7 @@ declare namespace BASE_BULLMQ_CONFIG {
815
815
  }
816
816
  export { workerConfig_12 as workerConfig };
817
817
  }
818
- namespace TAG_SYNC_PLAN_QUEUE {
818
+ namespace INTERCOM_CONVERSATIONS_QUEUE {
819
819
  let id_13: string;
820
820
  export { id_13 as id };
821
821
  export namespace queueConfig_13 {
@@ -855,7 +855,7 @@ declare namespace BASE_BULLMQ_CONFIG {
855
855
  }
856
856
  export { workerConfig_13 as workerConfig };
857
857
  }
858
- namespace TAG_SYNC_BATCH_QUEUE {
858
+ namespace TAG_SYNC_PLAN_QUEUE {
859
859
  let id_14: string;
860
860
  export { id_14 as id };
861
861
  export namespace queueConfig_14 {
@@ -895,11 +895,13 @@ declare namespace BASE_BULLMQ_CONFIG {
895
895
  }
896
896
  export { workerConfig_14 as workerConfig };
897
897
  }
898
- namespace SCHEDULED_EXTERNAL_SYNC_QUEUE {
898
+ namespace TAG_SYNC_BATCH_QUEUE {
899
899
  let id_15: string;
900
900
  export { id_15 as id };
901
901
  export namespace queueConfig_15 {
902
902
  export namespace defaultJobOptions_15 {
903
+ let attempts_15: number;
904
+ export { attempts_15 as attempts };
903
905
  export namespace backoff_15 {
904
906
  let type_15: string;
905
907
  export { type_15 as type };
@@ -907,8 +909,6 @@ declare namespace BASE_BULLMQ_CONFIG {
907
909
  export { delay_15 as delay };
908
910
  }
909
911
  export { backoff_15 as backoff };
910
- let attempts_15: number;
911
- export { attempts_15 as attempts };
912
912
  let removeOnComplete_15: number;
913
913
  export { removeOnComplete_15 as removeOnComplete };
914
914
  let removeOnFail_15: number;
@@ -935,13 +935,11 @@ declare namespace BASE_BULLMQ_CONFIG {
935
935
  }
936
936
  export { workerConfig_15 as workerConfig };
937
937
  }
938
- namespace REINDEX_QUEUE {
938
+ namespace SCHEDULED_EXTERNAL_SYNC_QUEUE {
939
939
  let id_16: string;
940
940
  export { id_16 as id };
941
941
  export namespace queueConfig_16 {
942
942
  export namespace defaultJobOptions_16 {
943
- let attempts_16: number;
944
- export { attempts_16 as attempts };
945
943
  export namespace backoff_16 {
946
944
  let type_16: string;
947
945
  export { type_16 as type };
@@ -949,8 +947,8 @@ declare namespace BASE_BULLMQ_CONFIG {
949
947
  export { delay_16 as delay };
950
948
  }
951
949
  export { backoff_16 as backoff };
952
- let delay_17: number;
953
- export { delay_17 as delay };
950
+ let attempts_16: number;
951
+ export { attempts_16 as attempts };
954
952
  let removeOnComplete_16: number;
955
953
  export { removeOnComplete_16 as removeOnComplete };
956
954
  let removeOnFail_16: number;
@@ -977,6 +975,48 @@ declare namespace BASE_BULLMQ_CONFIG {
977
975
  }
978
976
  export { workerConfig_16 as workerConfig };
979
977
  }
978
+ namespace REINDEX_QUEUE {
979
+ let id_17: string;
980
+ export { id_17 as id };
981
+ export namespace queueConfig_17 {
982
+ export namespace defaultJobOptions_17 {
983
+ let attempts_17: number;
984
+ export { attempts_17 as attempts };
985
+ export namespace backoff_17 {
986
+ let type_17: string;
987
+ export { type_17 as type };
988
+ let delay_17: number;
989
+ export { delay_17 as delay };
990
+ }
991
+ export { backoff_17 as backoff };
992
+ let delay_18: number;
993
+ export { delay_18 as delay };
994
+ let removeOnComplete_17: number;
995
+ export { removeOnComplete_17 as removeOnComplete };
996
+ let removeOnFail_17: number;
997
+ export { removeOnFail_17 as removeOnFail };
998
+ }
999
+ export { defaultJobOptions_17 as defaultJobOptions };
1000
+ export namespace streams_17 {
1001
+ export namespace events_17 {
1002
+ let maxLen_17: number;
1003
+ export { maxLen_17 as maxLen };
1004
+ }
1005
+ export { events_17 as events };
1006
+ }
1007
+ export { streams_17 as streams };
1008
+ }
1009
+ export { queueConfig_17 as queueConfig };
1010
+ export namespace workerConfig_17 {
1011
+ let concurrency_17: number;
1012
+ export { concurrency_17 as concurrency };
1013
+ let lockDuration_17: number;
1014
+ export { lockDuration_17 as lockDuration };
1015
+ let maxStalledCount_17: number;
1016
+ export { maxStalledCount_17 as maxStalledCount };
1017
+ }
1018
+ export { workerConfig_17 as workerConfig };
1019
+ }
980
1020
  }
981
1021
 
982
1022
  interface PlatformContextContentItem {
package/dist/node.d.ts CHANGED
@@ -495,7 +495,7 @@ declare namespace BASE_BULLMQ_CONFIG {
495
495
  }
496
496
  export { workerConfig_4 as workerConfig };
497
497
  }
498
- namespace AI_AUTO_ANNOTATE_QUEUE {
498
+ namespace AI_AUTO_ANNOTATE_PREP_QUEUE {
499
499
  let id_5: string;
500
500
  export { id_5 as id };
501
501
  export namespace queueConfig_5 {
@@ -535,7 +535,7 @@ declare namespace BASE_BULLMQ_CONFIG {
535
535
  }
536
536
  export { workerConfig_5 as workerConfig };
537
537
  }
538
- namespace AI_AUTO_ANNOTATE_CHUNK_QUEUE {
538
+ namespace AI_AUTO_ANNOTATE_QUEUE {
539
539
  let id_6: string;
540
540
  export { id_6 as id };
541
541
  export namespace queueConfig_6 {
@@ -575,7 +575,7 @@ declare namespace BASE_BULLMQ_CONFIG {
575
575
  }
576
576
  export { workerConfig_6 as workerConfig };
577
577
  }
578
- namespace ANNOS_ELASTIC_SYNC_QUEUE {
578
+ namespace AI_AUTO_ANNOTATE_CHUNK_QUEUE {
579
579
  let id_7: string;
580
580
  export { id_7 as id };
581
581
  export namespace queueConfig_7 {
@@ -615,7 +615,7 @@ declare namespace BASE_BULLMQ_CONFIG {
615
615
  }
616
616
  export { workerConfig_7 as workerConfig };
617
617
  }
618
- namespace CHUNKS_ELASTIC_SYNC_QUEUE {
618
+ namespace ANNOS_ELASTIC_SYNC_QUEUE {
619
619
  let id_8: string;
620
620
  export { id_8 as id };
621
621
  export namespace queueConfig_8 {
@@ -655,7 +655,7 @@ declare namespace BASE_BULLMQ_CONFIG {
655
655
  }
656
656
  export { workerConfig_8 as workerConfig };
657
657
  }
658
- namespace USERS_ELASTIC_SYNC_QUEUE {
658
+ namespace CHUNKS_ELASTIC_SYNC_QUEUE {
659
659
  let id_9: string;
660
660
  export { id_9 as id };
661
661
  export namespace queueConfig_9 {
@@ -695,7 +695,7 @@ declare namespace BASE_BULLMQ_CONFIG {
695
695
  }
696
696
  export { workerConfig_9 as workerConfig };
697
697
  }
698
- namespace CONTENT_ELASTIC_SYNC_QUEUE {
698
+ namespace USERS_ELASTIC_SYNC_QUEUE {
699
699
  let id_10: string;
700
700
  export { id_10 as id };
701
701
  export namespace queueConfig_10 {
@@ -735,7 +735,7 @@ declare namespace BASE_BULLMQ_CONFIG {
735
735
  }
736
736
  export { workerConfig_10 as workerConfig };
737
737
  }
738
- namespace SARVAM_TRANSCRIPTION_QUEUE {
738
+ namespace CONTENT_ELASTIC_SYNC_QUEUE {
739
739
  let id_11: string;
740
740
  export { id_11 as id };
741
741
  export namespace queueConfig_11 {
@@ -775,7 +775,7 @@ declare namespace BASE_BULLMQ_CONFIG {
775
775
  }
776
776
  export { workerConfig_11 as workerConfig };
777
777
  }
778
- namespace INTERCOM_CONVERSATIONS_QUEUE {
778
+ namespace SARVAM_TRANSCRIPTION_QUEUE {
779
779
  let id_12: string;
780
780
  export { id_12 as id };
781
781
  export namespace queueConfig_12 {
@@ -815,7 +815,7 @@ declare namespace BASE_BULLMQ_CONFIG {
815
815
  }
816
816
  export { workerConfig_12 as workerConfig };
817
817
  }
818
- namespace TAG_SYNC_PLAN_QUEUE {
818
+ namespace INTERCOM_CONVERSATIONS_QUEUE {
819
819
  let id_13: string;
820
820
  export { id_13 as id };
821
821
  export namespace queueConfig_13 {
@@ -855,7 +855,7 @@ declare namespace BASE_BULLMQ_CONFIG {
855
855
  }
856
856
  export { workerConfig_13 as workerConfig };
857
857
  }
858
- namespace TAG_SYNC_BATCH_QUEUE {
858
+ namespace TAG_SYNC_PLAN_QUEUE {
859
859
  let id_14: string;
860
860
  export { id_14 as id };
861
861
  export namespace queueConfig_14 {
@@ -895,11 +895,13 @@ declare namespace BASE_BULLMQ_CONFIG {
895
895
  }
896
896
  export { workerConfig_14 as workerConfig };
897
897
  }
898
- namespace SCHEDULED_EXTERNAL_SYNC_QUEUE {
898
+ namespace TAG_SYNC_BATCH_QUEUE {
899
899
  let id_15: string;
900
900
  export { id_15 as id };
901
901
  export namespace queueConfig_15 {
902
902
  export namespace defaultJobOptions_15 {
903
+ let attempts_15: number;
904
+ export { attempts_15 as attempts };
903
905
  export namespace backoff_15 {
904
906
  let type_15: string;
905
907
  export { type_15 as type };
@@ -907,8 +909,6 @@ declare namespace BASE_BULLMQ_CONFIG {
907
909
  export { delay_15 as delay };
908
910
  }
909
911
  export { backoff_15 as backoff };
910
- let attempts_15: number;
911
- export { attempts_15 as attempts };
912
912
  let removeOnComplete_15: number;
913
913
  export { removeOnComplete_15 as removeOnComplete };
914
914
  let removeOnFail_15: number;
@@ -935,13 +935,11 @@ declare namespace BASE_BULLMQ_CONFIG {
935
935
  }
936
936
  export { workerConfig_15 as workerConfig };
937
937
  }
938
- namespace REINDEX_QUEUE {
938
+ namespace SCHEDULED_EXTERNAL_SYNC_QUEUE {
939
939
  let id_16: string;
940
940
  export { id_16 as id };
941
941
  export namespace queueConfig_16 {
942
942
  export namespace defaultJobOptions_16 {
943
- let attempts_16: number;
944
- export { attempts_16 as attempts };
945
943
  export namespace backoff_16 {
946
944
  let type_16: string;
947
945
  export { type_16 as type };
@@ -949,8 +947,8 @@ declare namespace BASE_BULLMQ_CONFIG {
949
947
  export { delay_16 as delay };
950
948
  }
951
949
  export { backoff_16 as backoff };
952
- let delay_17: number;
953
- export { delay_17 as delay };
950
+ let attempts_16: number;
951
+ export { attempts_16 as attempts };
954
952
  let removeOnComplete_16: number;
955
953
  export { removeOnComplete_16 as removeOnComplete };
956
954
  let removeOnFail_16: number;
@@ -977,6 +975,48 @@ declare namespace BASE_BULLMQ_CONFIG {
977
975
  }
978
976
  export { workerConfig_16 as workerConfig };
979
977
  }
978
+ namespace REINDEX_QUEUE {
979
+ let id_17: string;
980
+ export { id_17 as id };
981
+ export namespace queueConfig_17 {
982
+ export namespace defaultJobOptions_17 {
983
+ let attempts_17: number;
984
+ export { attempts_17 as attempts };
985
+ export namespace backoff_17 {
986
+ let type_17: string;
987
+ export { type_17 as type };
988
+ let delay_17: number;
989
+ export { delay_17 as delay };
990
+ }
991
+ export { backoff_17 as backoff };
992
+ let delay_18: number;
993
+ export { delay_18 as delay };
994
+ let removeOnComplete_17: number;
995
+ export { removeOnComplete_17 as removeOnComplete };
996
+ let removeOnFail_17: number;
997
+ export { removeOnFail_17 as removeOnFail };
998
+ }
999
+ export { defaultJobOptions_17 as defaultJobOptions };
1000
+ export namespace streams_17 {
1001
+ export namespace events_17 {
1002
+ let maxLen_17: number;
1003
+ export { maxLen_17 as maxLen };
1004
+ }
1005
+ export { events_17 as events };
1006
+ }
1007
+ export { streams_17 as streams };
1008
+ }
1009
+ export { queueConfig_17 as queueConfig };
1010
+ export namespace workerConfig_17 {
1011
+ let concurrency_17: number;
1012
+ export { concurrency_17 as concurrency };
1013
+ let lockDuration_17: number;
1014
+ export { lockDuration_17 as lockDuration };
1015
+ let maxStalledCount_17: number;
1016
+ export { maxStalledCount_17 as maxStalledCount };
1017
+ }
1018
+ export { workerConfig_17 as workerConfig };
1019
+ }
980
1020
  }
981
1021
 
982
1022
  interface PlatformContextContentItem {
package/dist/node.js CHANGED
@@ -193,6 +193,58 @@ var init_GLOBAL_BULLMQ_CONFIG = __esm({
193
193
  }
194
194
  }
195
195
  },
196
+ AI_AUTO_ANNOTATE_PREP_QUEUE: {
197
+ // PREP queue — the front of the per-doc Flow pipeline. The FE-facing
198
+ // /AIAutoAnnotate handler no longer fetches + summarizes + chunks +
199
+ // enqueues each doc inline (that serial, LLM-heavy loop blocked the HTTP
200
+ // request and risked App Engine clipping large batches mid-loop, silently
201
+ // dropping every doc past the cutoff). Instead the handler computes the
202
+ // batch-level prereqs ONCE (7th criterion + platform-derived categories)
203
+ // and enqueues one PREP job per doc here, then returns fast.
204
+ //
205
+ // Each prep job's worker (okf-sub) calls okf-be /internal/prepDoc, which
206
+ // does the per-doc work: fetch → summarizeDocument (warms the doc-level
207
+ // summary cache) → chunk fields → enqueue that doc's Flow (parent on
208
+ // AI_AUTO_ANNOTATE_QUEUE + one child per chunk on the CHUNK queue). So the
209
+ // Flow parents now get created rolling, as each prep job completes, rather
210
+ // than all up-front in the request. A prep failure isolates to its one doc
211
+ // (that doc is skipped); sibling prep jobs keep going.
212
+ id: "ai-auto-annotate-prep-queue",
213
+ queueConfig: {
214
+ defaultJobOptions: {
215
+ // attempts:1 — a retry would re-summarize (cache-HIT, cheap) but then
216
+ // re-enqueue the doc's Flow, double-annotating the doc. The rest of
217
+ // the per-doc Flow pipeline is attempts:1 for the same fail-loud
218
+ // reason (a retry just re-fires expensive LLM work).
219
+ attempts: 1,
220
+ backoff: {
221
+ type: "exponential",
222
+ delay: 5e3
223
+ },
224
+ removeOnComplete: 30,
225
+ removeOnFail: 100
226
+ },
227
+ streams: {
228
+ events: {
229
+ maxLen: 10
230
+ }
231
+ }
232
+ },
233
+ workerConfig: {
234
+ // Each prep job = one Mongo doc fetch + ONE summarize LLM call + a
235
+ // deterministic chunk + a Flow enqueue. It's lighter than a chunk job
236
+ // (which does ~4 LLM calls), so we can run more in parallel — 10 keeps
237
+ // prep comfortably AHEAD of the downstream chunk queue (concurrency 5),
238
+ // which is the real throughput cap. Going much higher than that buys
239
+ // little: prep would just drain faster into a chunk queue that still
240
+ // processes 5 at a time, while adding concurrent okf-be /internal/prepDoc
241
+ // load + concurrent summarize calls against the shared OpenAI TPM budget.
242
+ concurrency: 10,
243
+ lockDuration: 3e5,
244
+ // 5 min — generous ceiling over the 180s summarizer timeout
245
+ maxStalledCount: 1
246
+ }
247
+ },
196
248
  AI_AUTO_ANNOTATE_QUEUE: {
197
249
  // PARENT queue in the per-doc Flow. One job per doc; child jobs (one
198
250
  // per chunk) live on AI_AUTO_ANNOTATE_CHUNK_QUEUE. BullMQ Flow fires
@@ -3509,6 +3561,7 @@ var buildFilterConfigurations = ({ groups, type, selectedTpls, allTpls, isRollup
3509
3561
  scope: section.filterScope
3510
3562
  };
3511
3563
  };
3564
+ const isSelfTerminalTag = element.rollupPath.length === 1 && !isLastTagProfile && !isTerminalValuePath;
3512
3565
  return {
3513
3566
  filterId: `ROLLUP_${section.filterScope}_${element.rollupPath.join(
3514
3567
  "_"
@@ -3522,9 +3575,14 @@ var buildFilterConfigurations = ({ groups, type, selectedTpls, allTpls, isRollup
3522
3575
  scope: section.filterScope
3523
3576
  }),
3524
3577
  contentType: element.rollupPath[0],
3525
- path: `tags.${element.rollupPath[1]}`,
3578
+ path: `tags.${isSelfTerminalTag ? element.rollupPath[0] : element.rollupPath[1]}`,
3526
3579
  source: getSourceConfig(),
3527
- target: {
3580
+ target: isSelfTerminalTag ? {
3581
+ filterType: "tagType",
3582
+ tagType: element.rollupPath[0],
3583
+ rollupPath: element.rollupPath,
3584
+ ...isAnno && { isAnno: true }
3585
+ } : {
3528
3586
  filterType: "nestedRollupTagType",
3529
3587
  rollupPath: element.rollupPath,
3530
3588
  ...isAnno && { isAnno: true }
package/dist/node.mjs CHANGED
@@ -198,6 +198,58 @@ var init_GLOBAL_BULLMQ_CONFIG = __esm({
198
198
  }
199
199
  }
200
200
  },
201
+ AI_AUTO_ANNOTATE_PREP_QUEUE: {
202
+ // PREP queue — the front of the per-doc Flow pipeline. The FE-facing
203
+ // /AIAutoAnnotate handler no longer fetches + summarizes + chunks +
204
+ // enqueues each doc inline (that serial, LLM-heavy loop blocked the HTTP
205
+ // request and risked App Engine clipping large batches mid-loop, silently
206
+ // dropping every doc past the cutoff). Instead the handler computes the
207
+ // batch-level prereqs ONCE (7th criterion + platform-derived categories)
208
+ // and enqueues one PREP job per doc here, then returns fast.
209
+ //
210
+ // Each prep job's worker (okf-sub) calls okf-be /internal/prepDoc, which
211
+ // does the per-doc work: fetch → summarizeDocument (warms the doc-level
212
+ // summary cache) → chunk fields → enqueue that doc's Flow (parent on
213
+ // AI_AUTO_ANNOTATE_QUEUE + one child per chunk on the CHUNK queue). So the
214
+ // Flow parents now get created rolling, as each prep job completes, rather
215
+ // than all up-front in the request. A prep failure isolates to its one doc
216
+ // (that doc is skipped); sibling prep jobs keep going.
217
+ id: "ai-auto-annotate-prep-queue",
218
+ queueConfig: {
219
+ defaultJobOptions: {
220
+ // attempts:1 — a retry would re-summarize (cache-HIT, cheap) but then
221
+ // re-enqueue the doc's Flow, double-annotating the doc. The rest of
222
+ // the per-doc Flow pipeline is attempts:1 for the same fail-loud
223
+ // reason (a retry just re-fires expensive LLM work).
224
+ attempts: 1,
225
+ backoff: {
226
+ type: "exponential",
227
+ delay: 5e3
228
+ },
229
+ removeOnComplete: 30,
230
+ removeOnFail: 100
231
+ },
232
+ streams: {
233
+ events: {
234
+ maxLen: 10
235
+ }
236
+ }
237
+ },
238
+ workerConfig: {
239
+ // Each prep job = one Mongo doc fetch + ONE summarize LLM call + a
240
+ // deterministic chunk + a Flow enqueue. It's lighter than a chunk job
241
+ // (which does ~4 LLM calls), so we can run more in parallel — 10 keeps
242
+ // prep comfortably AHEAD of the downstream chunk queue (concurrency 5),
243
+ // which is the real throughput cap. Going much higher than that buys
244
+ // little: prep would just drain faster into a chunk queue that still
245
+ // processes 5 at a time, while adding concurrent okf-be /internal/prepDoc
246
+ // load + concurrent summarize calls against the shared OpenAI TPM budget.
247
+ concurrency: 10,
248
+ lockDuration: 3e5,
249
+ // 5 min — generous ceiling over the 180s summarizer timeout
250
+ maxStalledCount: 1
251
+ }
252
+ },
201
253
  AI_AUTO_ANNOTATE_QUEUE: {
202
254
  // PARENT queue in the per-doc Flow. One job per doc; child jobs (one
203
255
  // per chunk) live on AI_AUTO_ANNOTATE_CHUNK_QUEUE. BullMQ Flow fires
@@ -3437,6 +3489,7 @@ var buildFilterConfigurations = ({ groups, type, selectedTpls, allTpls, isRollup
3437
3489
  scope: section.filterScope
3438
3490
  };
3439
3491
  };
3492
+ const isSelfTerminalTag = element.rollupPath.length === 1 && !isLastTagProfile && !isTerminalValuePath;
3440
3493
  return {
3441
3494
  filterId: `ROLLUP_${section.filterScope}_${element.rollupPath.join(
3442
3495
  "_"
@@ -3450,9 +3503,14 @@ var buildFilterConfigurations = ({ groups, type, selectedTpls, allTpls, isRollup
3450
3503
  scope: section.filterScope
3451
3504
  }),
3452
3505
  contentType: element.rollupPath[0],
3453
- path: `tags.${element.rollupPath[1]}`,
3506
+ path: `tags.${isSelfTerminalTag ? element.rollupPath[0] : element.rollupPath[1]}`,
3454
3507
  source: getSourceConfig(),
3455
- target: {
3508
+ target: isSelfTerminalTag ? {
3509
+ filterType: "tagType",
3510
+ tagType: element.rollupPath[0],
3511
+ rollupPath: element.rollupPath,
3512
+ ...isAnno && { isAnno: true }
3513
+ } : {
3456
3514
  filterType: "nestedRollupTagType",
3457
3515
  rollupPath: element.rollupPath,
3458
3516
  ...isAnno && { isAnno: true }