@praxisui/table 8.0.0-beta.56 → 8.0.0-beta.58

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.
@@ -38808,8 +38808,12 @@ class PraxisTable {
38808
38808
  }
38809
38809
  const href = this.resolveRowDiscoveryHref(rowLinks, 'capabilities');
38810
38810
  const surfaceHref = this.resolveRowSurfaceDiscoveryHref(rowLinks);
38811
- if (href && this.hasFreshRowCapabilitySnapshot(href)) {
38812
- return;
38811
+ const hasFreshCapabilitySnapshot = !!href && this.hasFreshRowCapabilitySnapshot(href);
38812
+ if (hasFreshCapabilitySnapshot) {
38813
+ const snapshot = this.rowCapabilitySnapshotByHref.get(href);
38814
+ if (snapshot?.surfaces?.length || !surfaceHref || this.hasFreshRowCapabilitySnapshot(surfaceHref)) {
38815
+ return;
38816
+ }
38813
38817
  }
38814
38818
  if (!href && surfaceHref && this.hasFreshRowCapabilitySnapshot(surfaceHref)) {
38815
38819
  return;
@@ -38817,7 +38821,7 @@ class PraxisTable {
38817
38821
  if (!href && !surfaceHref) {
38818
38822
  return;
38819
38823
  }
38820
- const cacheHref = href ?? surfaceHref;
38824
+ const cacheHref = hasFreshCapabilitySnapshot ? surfaceHref : href ?? surfaceHref;
38821
38825
  if (!cacheHref) {
38822
38826
  return;
38823
38827
  }
@@ -38827,7 +38831,7 @@ class PraxisTable {
38827
38831
  return;
38828
38832
  }
38829
38833
  try {
38830
- if (href) {
38834
+ if (href && !hasFreshCapabilitySnapshot) {
38831
38835
  const snapshot = await firstValueFrom(this.resourceDiscovery.getCapabilities(rowLinks, this.buildRowDiscoveryOptions())
38832
38836
  .pipe(take$1(1)));
38833
38837
  this.clearRowCapabilityError(href);
@@ -39574,7 +39578,7 @@ class PraxisTable {
39574
39578
  if (this.aiAdapter || this.aiAdapterLoadStarted)
39575
39579
  return;
39576
39580
  this.aiAdapterLoadStarted = true;
39577
- import('./praxisui-table-table-ai.adapter-Cb0SlfHg.mjs')
39581
+ import('./praxisui-table-table-ai.adapter-chITgbwi.mjs')
39578
39582
  .then(({ TableAiAdapter }) => {
39579
39583
  this.aiAdapter = new TableAiAdapter(this);
39580
39584
  this.initializeAiAssistantController();
@@ -39724,7 +39728,7 @@ class PraxisTable {
39724
39728
  initializeAiAssistantController() {
39725
39729
  if (!this.aiAdapter || this.aiAssistantController)
39726
39730
  return;
39727
- import('./praxisui-table-table-agentic-authoring-turn-flow-EmXDCUna.mjs')
39731
+ import('./praxisui-table-table-agentic-authoring-turn-flow-BQmEaQUf.mjs')
39728
39732
  .then(({ TableAgenticAuthoringTurnFlow }) => {
39729
39733
  if (this.aiAssistantController || !this.aiAdapter)
39730
39734
  return;
@@ -46620,14 +46624,22 @@ class PraxisTable {
46620
46624
  return null;
46621
46625
  }
46622
46626
  const href = this.resolveRowDiscoveryHref(rowLinks, 'capabilities');
46627
+ let capabilitySnapshot = null;
46623
46628
  if (href && this.hasFreshRowCapabilitySnapshot(href)) {
46624
- return this.rowCapabilitySnapshotByHref.get(href) || null;
46629
+ capabilitySnapshot = this.rowCapabilitySnapshotByHref.get(href) || null;
46630
+ if (capabilitySnapshot?.surfaces?.length) {
46631
+ return capabilitySnapshot;
46632
+ }
46625
46633
  }
46626
46634
  const surfaceHref = this.resolveRowSurfaceDiscoveryHref(rowLinks);
46627
46635
  if (surfaceHref && this.hasFreshRowCapabilitySnapshot(surfaceHref)) {
46628
- return this.rowCapabilitySnapshotByHref.get(surfaceHref) || null;
46636
+ const surfaceSnapshot = this.rowCapabilitySnapshotByHref.get(surfaceHref) || null;
46637
+ if (surfaceSnapshot?.surfaces?.length) {
46638
+ return surfaceSnapshot;
46639
+ }
46640
+ return capabilitySnapshot ?? surfaceSnapshot;
46629
46641
  }
46630
- return null;
46642
+ return capabilitySnapshot;
46631
46643
  }
46632
46644
  hasResolvedRowActionCatalog(row) {
46633
46645
  const rowLinks = this.getRowLinks(row);
@@ -10,6 +10,7 @@ class TableAgenticAuthoringTurnFlow {
10
10
  selectedRecordFieldsForTurn = new Set();
11
11
  selectedRecordsCountForTurn = 0;
12
12
  filterExpressionSupportedForTurn = null;
13
+ contextHintsForTurn = null;
13
14
  streamTerminalWatchdogMs = 75_000;
14
15
  streamTerminalReconnectLimit = 2;
15
16
  selectedRecordStreamTerminalWatchdogMs = 45_000;
@@ -48,6 +49,7 @@ class TableAgenticAuthoringTurnFlow {
48
49
  this.selectedRecordFieldsForTurn = this.extractSelectedRecordFields(contextHints);
49
50
  this.selectedRecordsCountForTurn = this.extractSelectedRecordsCount(contextHints);
50
51
  this.filterExpressionSupportedForTurn = this.resolveFilterExpressionSupported(contextHints);
52
+ this.contextHintsForTurn = contextHints;
51
53
  const messages = this.withCapabilitySystemMessages(this.toChatMessages(request.messages, prompt), contextHints);
52
54
  return {
53
55
  contextHints,
@@ -803,12 +805,16 @@ class TableAgenticAuthoringTurnFlow {
803
805
  const prompt = this.normalizeLabel(request?.prompt ?? '');
804
806
  if (!prompt)
805
807
  return null;
808
+ const groundedSurfaceOperation = this.selectedRecordSurfaceOperationForMisgroundedFilter(prompt, request);
809
+ if (groundedSurfaceOperation) {
810
+ return groundedSurfaceOperation;
811
+ }
806
812
  const implicitFields = operations
807
813
  .flatMap((operation) => Object.keys(this.toRecord(this.toRecord(operation['input'])?.['criteria']) ?? {}))
808
814
  .filter((field) => field && !this.promptMentionsFilterField(prompt, field));
809
815
  if (!implicitFields.length)
810
816
  return null;
811
- const contextHints = this.toRecord(request?.contextHints);
817
+ const contextHints = this.contextHintsFor(request);
812
818
  // This guard runs only after the LLM authored an executable table.filter.apply
813
819
  // operation. It does not route primary intent; it blocks ungrounded
814
820
  // materialization when selected rows offer multiple plausible filter fields.
@@ -829,6 +835,110 @@ class TableAgenticAuthoringTurnFlow {
829
835
  ],
830
836
  };
831
837
  }
838
+ selectedRecordSurfaceOperationForMisgroundedFilter(normalizedPrompt, request) {
839
+ if (this.promptRequestsSimilarRecords(normalizedPrompt))
840
+ return null;
841
+ const contextHints = this.contextHintsFor(request);
842
+ const surfaces = this.selectedRecordSurfaces(contextHints);
843
+ if (!surfaces.length)
844
+ return null;
845
+ const ranked = surfaces
846
+ .map((surface) => ({
847
+ surface,
848
+ score: this.selectedRecordSurfacePromptScore(normalizedPrompt, surface),
849
+ }))
850
+ .filter((entry) => entry.score >= 2)
851
+ .sort((a, b) => b.score - a.score);
852
+ if (!ranked.length || (ranked.length > 1 && ranked[0].score === ranked[1].score)) {
853
+ return null;
854
+ }
855
+ const surface = ranked[0].surface;
856
+ const surfaceId = this.stringValue(surface['id']);
857
+ if (!surfaceId)
858
+ return null;
859
+ const surfaceLabel = this.stringValue(surface['label'])
860
+ || this.stringValue(this.toRecord(surface['resourceSurface'])?.['title'])
861
+ || this.humanizeField(surfaceId);
862
+ // Residual grounding guard: this runs only after the LLM authored a
863
+ // selected-record table.filter.apply operation. It ranks declared canonical
864
+ // recordSurfaces to correct an unsafe filter materialization, not to route
865
+ // primary user intent by command text.
866
+ return {
867
+ type: 'patch',
868
+ patch: {
869
+ tableRuntimeOperations: {
870
+ source: 'selected-record-surface-grounding-guard',
871
+ operations: [{
872
+ operationId: 'dynamicPage.surface.open',
873
+ input: {
874
+ surfaceId,
875
+ surfaceLabel,
876
+ source: 'selected-records',
877
+ },
878
+ }],
879
+ },
880
+ },
881
+ warnings: [
882
+ 'selected-record-filter-materialization-corrected-to-record-surface',
883
+ 'Residual grounding guard acted only after LLM proposed table.filter.apply while declared recordSurfaces semantically matched the selected-record request.',
884
+ ],
885
+ };
886
+ }
887
+ promptRequestsSimilarRecords(normalizedPrompt) {
888
+ return [
889
+ 'registro parecido',
890
+ 'registros parecidos',
891
+ 'outro registro',
892
+ 'outros registros',
893
+ 'buscar registros',
894
+ 'procurar registros',
895
+ 'filtrar registros',
896
+ 'filtrar por',
897
+ ].some((needle) => this.normalizedTextContainsApproxPhrase(normalizedPrompt, needle));
898
+ }
899
+ selectedRecordSurfacePromptScore(normalizedPrompt, surface) {
900
+ const resourceSurface = this.toRecord(surface['resourceSurface']);
901
+ const tags = Array.isArray(resourceSurface?.['tags']) ? resourceSurface['tags'] : [];
902
+ const haystack = this.normalizeLabel([
903
+ this.stringValue(surface['id']),
904
+ this.stringValue(surface['label']),
905
+ this.stringValue(surface['description']),
906
+ this.stringValue(surface['relation']),
907
+ this.stringValue(resourceSurface?.['id']),
908
+ this.stringValue(resourceSurface?.['title']),
909
+ this.stringValue(resourceSurface?.['description']),
910
+ this.stringValue(resourceSurface?.['semanticIntent']),
911
+ this.stringValue(resourceSurface?.['kind']),
912
+ this.stringValue(resourceSurface?.['scope']),
913
+ ...tags.map((tag) => this.stringValue(tag)),
914
+ ].join(' '));
915
+ const promptTokens = normalizedPrompt
916
+ .split(/\s+/u)
917
+ .map((token) => token.trim())
918
+ .filter((token) => token.length >= 4 && !this.isSelectedRecordSurfaceStopToken(token));
919
+ return [...new Set(promptTokens)]
920
+ .reduce((score, token) => score + (haystack.includes(token) ? 1 : 0), 0);
921
+ }
922
+ isSelectedRecordSurfaceStopToken(token) {
923
+ return [
924
+ 'quero',
925
+ 'mostra',
926
+ 'mostrar',
927
+ 'mostre',
928
+ 'abrir',
929
+ 'abre',
930
+ 'deste',
931
+ 'desse',
932
+ 'dele',
933
+ 'dela',
934
+ 'registro',
935
+ 'selecionado',
936
+ 'selecionada',
937
+ ].includes(token);
938
+ }
939
+ contextHintsFor(request) {
940
+ return this.toRecord(request?.contextHints) ?? this.contextHintsForTurn;
941
+ }
832
942
  tableFilterApplyOperations(patch) {
833
943
  const envelope = this.toRecord(this.toRecord(patch)?.['tableRuntimeOperations']);
834
944
  const operations = Array.isArray(envelope?.['operations']) ? envelope['operations'] : [];
@@ -1188,8 +1298,9 @@ class TableAgenticAuthoringTurnFlow {
1188
1298
  }
1189
1299
  if (operationId === 'dynamicPage.surface.open') {
1190
1300
  const surfaceId = this.stringValue(input['surfaceId'] ?? input['id']);
1301
+ const surfaceLabel = this.stringValue(input['surfaceLabel']);
1191
1302
  return surfaceId
1192
- ? `Vou abrir a superfície relacionada **${this.humanizeField(surfaceId)}**.`
1303
+ ? `Vou abrir a superfície relacionada **${surfaceLabel || this.humanizeField(surfaceId)}**.`
1193
1304
  : 'Vou abrir a superfície relacionada solicitada.';
1194
1305
  }
1195
1306
  return null;
@@ -1,7 +1,7 @@
1
1
  import { firstValueFrom } from 'rxjs';
2
2
  import { BaseAiAdapter, createComponentAuthoringContext } from '@praxisui/ai';
3
3
  import { deepMerge } from '@praxisui/core';
4
- import { z as TABLE_COMPONENT_EDIT_PLAN_OPERATION_IDS, k as PRAXIS_TABLE_AUTHORING_MANIFEST, T as TABLE_AI_CAPABILITIES, R as coerceTableComponentEditPlans, W as compileTableComponentEditPlans, G as TASK_PRESETS, $ as getTableComponentEditPlanCapabilities, w as TABLE_COMPONENT_EDIT_PLAN_EXPECTED_PATHS, u as TABLE_COMPONENT_EDIT_PLAN_ALLOWED_CHANGE_KINDS, x as TABLE_COMPONENT_EDIT_PLAN_JSON_SCHEMA, E as TABLE_COMPONENT_EDIT_PLAN_VERSION, v as TABLE_COMPONENT_EDIT_PLAN_BATCH_KIND, y as TABLE_COMPONENT_EDIT_PLAN_KIND } from './praxisui-table-praxisui-table-CLcLxit9.mjs';
4
+ import { z as TABLE_COMPONENT_EDIT_PLAN_OPERATION_IDS, k as PRAXIS_TABLE_AUTHORING_MANIFEST, T as TABLE_AI_CAPABILITIES, R as coerceTableComponentEditPlans, W as compileTableComponentEditPlans, G as TASK_PRESETS, $ as getTableComponentEditPlanCapabilities, w as TABLE_COMPONENT_EDIT_PLAN_EXPECTED_PATHS, u as TABLE_COMPONENT_EDIT_PLAN_ALLOWED_CHANGE_KINDS, x as TABLE_COMPONENT_EDIT_PLAN_JSON_SCHEMA, E as TABLE_COMPONENT_EDIT_PLAN_VERSION, v as TABLE_COMPONENT_EDIT_PLAN_BATCH_KIND, y as TABLE_COMPONENT_EDIT_PLAN_KIND } from './praxisui-table-praxisui-table-DJyX5HSH.mjs';
5
5
 
6
6
  const TABLE_COMPONENT_CONTEXT_PACK = {
7
7
  version: 'v1',
@@ -1 +1 @@
1
- export { A as AnalyticsTableConfigAdapterService, a as AnalyticsTableContractService, b as AnalyticsTableStatsApiService, B as BOOLEAN_PRESETS, c as BehaviorConfigEditorComponent, C as CURRENCY_PRESETS, d as ColumnsConfigEditorComponent, D as DATE_PRESETS, e as DataFormatterComponent, f as DataFormattingService, F as FORMULA_TEMPLATES, g as FilterConfigService, h as FilterSettingsComponent, i as FormulaGeneratorService, J as JsonConfigEditorComponent, M as MessagesLocalizationEditorComponent, N as NUMBER_PRESETS, P as PERCENTAGE_PRESETS, j as PRAXIS_FILTER_COMPONENT_METADATA, k as PRAXIS_TABLE_AUTHORING_MANIFEST, l as PRAXIS_TABLE_COMPONENT_METADATA, m as PraxisFilter, n as PraxisFilterWidgetConfigEditor, o as PraxisTable, p as PraxisTableConfigEditor, q as PraxisTableInlineAuthoringEditorComponent, r as PraxisTableToolbar, s as PraxisTableWidgetConfigEditor, S as STRING_PRESETS, T as TABLE_AI_CAPABILITIES, t as TABLE_COMPONENT_AI_CAPABILITIES, u as TABLE_COMPONENT_EDIT_PLAN_ALLOWED_CHANGE_KINDS, v as TABLE_COMPONENT_EDIT_PLAN_BATCH_KIND, w as TABLE_COMPONENT_EDIT_PLAN_EXPECTED_PATHS, x as TABLE_COMPONENT_EDIT_PLAN_JSON_SCHEMA, y as TABLE_COMPONENT_EDIT_PLAN_KIND, E as TABLE_COMPONENT_EDIT_PLAN_VERSION, G as TASK_PRESETS, H as TableDefaultsProvider, I as TableRulesEditorComponent, K as ToolbarActionsEditorComponent, V as ValueMappingEditorComponent, L as VisualFormulaBuilderComponent, O as buildTableApplyPlan, Q as coerceTableComponentEditPlan, R as coerceTableComponentEditPlans, U as compileTableComponentEditPlan, W as compileTableComponentEditPlans, X as createTableAuthoringDocument, Y as getActionId, Z as getEnum, _ as getTableCapabilities, $ as getTableComponentEditPlanCapabilities, a0 as isTableRendererSupportedByRichContentP0, a1 as mapTableRendererToRichContentP0, a2 as normalizeTableAuthoringDocument, a3 as parseLegacyOrTableDocument, a4 as providePraxisFilterMetadata, a5 as providePraxisTableMetadata, a6 as serializeTableAuthoringDocument, a7 as toCanonicalTableConfig, a8 as validateTableAuthoringDocument } from './praxisui-table-praxisui-table-CLcLxit9.mjs';
1
+ export { A as AnalyticsTableConfigAdapterService, a as AnalyticsTableContractService, b as AnalyticsTableStatsApiService, B as BOOLEAN_PRESETS, c as BehaviorConfigEditorComponent, C as CURRENCY_PRESETS, d as ColumnsConfigEditorComponent, D as DATE_PRESETS, e as DataFormatterComponent, f as DataFormattingService, F as FORMULA_TEMPLATES, g as FilterConfigService, h as FilterSettingsComponent, i as FormulaGeneratorService, J as JsonConfigEditorComponent, M as MessagesLocalizationEditorComponent, N as NUMBER_PRESETS, P as PERCENTAGE_PRESETS, j as PRAXIS_FILTER_COMPONENT_METADATA, k as PRAXIS_TABLE_AUTHORING_MANIFEST, l as PRAXIS_TABLE_COMPONENT_METADATA, m as PraxisFilter, n as PraxisFilterWidgetConfigEditor, o as PraxisTable, p as PraxisTableConfigEditor, q as PraxisTableInlineAuthoringEditorComponent, r as PraxisTableToolbar, s as PraxisTableWidgetConfigEditor, S as STRING_PRESETS, T as TABLE_AI_CAPABILITIES, t as TABLE_COMPONENT_AI_CAPABILITIES, u as TABLE_COMPONENT_EDIT_PLAN_ALLOWED_CHANGE_KINDS, v as TABLE_COMPONENT_EDIT_PLAN_BATCH_KIND, w as TABLE_COMPONENT_EDIT_PLAN_EXPECTED_PATHS, x as TABLE_COMPONENT_EDIT_PLAN_JSON_SCHEMA, y as TABLE_COMPONENT_EDIT_PLAN_KIND, E as TABLE_COMPONENT_EDIT_PLAN_VERSION, G as TASK_PRESETS, H as TableDefaultsProvider, I as TableRulesEditorComponent, K as ToolbarActionsEditorComponent, V as ValueMappingEditorComponent, L as VisualFormulaBuilderComponent, O as buildTableApplyPlan, Q as coerceTableComponentEditPlan, R as coerceTableComponentEditPlans, U as compileTableComponentEditPlan, W as compileTableComponentEditPlans, X as createTableAuthoringDocument, Y as getActionId, Z as getEnum, _ as getTableCapabilities, $ as getTableComponentEditPlanCapabilities, a0 as isTableRendererSupportedByRichContentP0, a1 as mapTableRendererToRichContentP0, a2 as normalizeTableAuthoringDocument, a3 as parseLegacyOrTableDocument, a4 as providePraxisFilterMetadata, a5 as providePraxisTableMetadata, a6 as serializeTableAuthoringDocument, a7 as toCanonicalTableConfig, a8 as validateTableAuthoringDocument } from './praxisui-table-praxisui-table-DJyX5HSH.mjs';
package/package.json CHANGED
@@ -1,23 +1,23 @@
1
1
  {
2
2
  "name": "@praxisui/table",
3
- "version": "8.0.0-beta.56",
3
+ "version": "8.0.0-beta.58",
4
4
  "description": "Advanced data table for Angular (Praxis UI) with editing, filtering, sorting, virtualization, and settings panel integration.",
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^21.0.0",
7
7
  "@angular/core": "^21.0.0",
8
- "@praxisui/ai": "^8.0.0-beta.56",
9
- "@praxisui/core": "^8.0.0-beta.56",
10
- "@praxisui/dynamic-fields": "^8.0.0-beta.56",
11
- "@praxisui/dynamic-form": "^8.0.0-beta.56",
12
- "@praxisui/metadata-editor": "^8.0.0-beta.56",
13
- "@praxisui/rich-content": "^8.0.0-beta.56",
14
- "@praxisui/settings-panel": "^8.0.0-beta.56",
15
- "@praxisui/table-rule-builder": "^8.0.0-beta.56",
8
+ "@praxisui/ai": "^8.0.0-beta.58",
9
+ "@praxisui/core": "^8.0.0-beta.58",
10
+ "@praxisui/dynamic-fields": "^8.0.0-beta.58",
11
+ "@praxisui/dynamic-form": "^8.0.0-beta.58",
12
+ "@praxisui/metadata-editor": "^8.0.0-beta.58",
13
+ "@praxisui/rich-content": "^8.0.0-beta.58",
14
+ "@praxisui/settings-panel": "^8.0.0-beta.58",
15
+ "@praxisui/table-rule-builder": "^8.0.0-beta.58",
16
16
  "@angular/cdk": "^21.0.0",
17
17
  "@angular/forms": "^21.0.0",
18
18
  "@angular/material": "^21.0.0",
19
19
  "@angular/router": "^21.0.0",
20
- "@praxisui/dialog": "^8.0.0-beta.56",
20
+ "@praxisui/dialog": "^8.0.0-beta.58",
21
21
  "rxjs": "~7.8.0"
22
22
  },
23
23
  "dependencies": {