@praxisui/table 8.0.0-beta.57 → 8.0.0-beta.59

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.
@@ -39578,7 +39578,7 @@ class PraxisTable {
39578
39578
  if (this.aiAdapter || this.aiAdapterLoadStarted)
39579
39579
  return;
39580
39580
  this.aiAdapterLoadStarted = true;
39581
- import('./praxisui-table-table-ai.adapter-HW-Hh4ID.mjs')
39581
+ import('./praxisui-table-table-ai.adapter-CRQf8Vjv.mjs')
39582
39582
  .then(({ TableAiAdapter }) => {
39583
39583
  this.aiAdapter = new TableAiAdapter(this);
39584
39584
  this.initializeAiAssistantController();
@@ -39728,7 +39728,7 @@ class PraxisTable {
39728
39728
  initializeAiAssistantController() {
39729
39729
  if (!this.aiAdapter || this.aiAssistantController)
39730
39730
  return;
39731
- import('./praxisui-table-table-agentic-authoring-turn-flow-EmXDCUna.mjs')
39731
+ import('./praxisui-table-table-agentic-authoring-turn-flow-BoMxaF18.mjs')
39732
39732
  .then(({ TableAgenticAuthoringTurnFlow }) => {
39733
39733
  if (this.aiAssistantController || !this.aiAdapter)
39734
39734
  return;
@@ -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,123 @@ 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['title']),
906
+ this.stringValue(surface['description']),
907
+ this.stringValue(surface['semanticDescription']),
908
+ this.stringValue(surface['semanticIntent']),
909
+ this.stringValue(surface['kind']),
910
+ this.stringValue(surface['scope']),
911
+ this.stringValue(surface['relation']),
912
+ this.stringValue(resourceSurface?.['id']),
913
+ this.stringValue(resourceSurface?.['title']),
914
+ this.stringValue(resourceSurface?.['description']),
915
+ this.stringValue(resourceSurface?.['semanticIntent']),
916
+ this.stringValue(resourceSurface?.['kind']),
917
+ this.stringValue(resourceSurface?.['scope']),
918
+ ...this.compactStringArray(surface['tags']),
919
+ ...tags.map((tag) => this.stringValue(tag)),
920
+ ].join(' '));
921
+ const promptTokens = normalizedPrompt
922
+ .split(/\s+/u)
923
+ .map((token) => token.trim())
924
+ .filter((token) => token.length >= 4 && !this.isSelectedRecordSurfaceStopToken(token));
925
+ return [...new Set(promptTokens)]
926
+ .reduce((score, token) => score + (haystack.includes(token) ? 1 : 0), 0);
927
+ }
928
+ isSelectedRecordSurfaceStopToken(token) {
929
+ return [
930
+ 'quero',
931
+ 'mostra',
932
+ 'mostrar',
933
+ 'mostre',
934
+ 'abrir',
935
+ 'abre',
936
+ 'deste',
937
+ 'desse',
938
+ 'dele',
939
+ 'dela',
940
+ 'registro',
941
+ 'selecionado',
942
+ 'selecionada',
943
+ ].includes(token);
944
+ }
945
+ compactStringArray(value) {
946
+ return Array.isArray(value)
947
+ ? value
948
+ .map((entry) => this.stringValue(entry))
949
+ .filter((entry) => !!entry)
950
+ : [];
951
+ }
952
+ contextHintsFor(request) {
953
+ return this.toRecord(request?.contextHints) ?? this.contextHintsForTurn;
954
+ }
832
955
  tableFilterApplyOperations(patch) {
833
956
  const envelope = this.toRecord(this.toRecord(patch)?.['tableRuntimeOperations']);
834
957
  const operations = Array.isArray(envelope?.['operations']) ? envelope['operations'] : [];
@@ -1188,8 +1311,9 @@ class TableAgenticAuthoringTurnFlow {
1188
1311
  }
1189
1312
  if (operationId === 'dynamicPage.surface.open') {
1190
1313
  const surfaceId = this.stringValue(input['surfaceId'] ?? input['id']);
1314
+ const surfaceLabel = this.stringValue(input['surfaceLabel']);
1191
1315
  return surfaceId
1192
- ? `Vou abrir a superfície relacionada **${this.humanizeField(surfaceId)}**.`
1316
+ ? `Vou abrir a superfície relacionada **${surfaceLabel || this.humanizeField(surfaceId)}**.`
1193
1317
  : 'Vou abrir a superfície relacionada solicitada.';
1194
1318
  }
1195
1319
  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-2nSPgkfc.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-DmOoFvig.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-2nSPgkfc.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-DmOoFvig.mjs';
package/package.json CHANGED
@@ -1,23 +1,23 @@
1
1
  {
2
2
  "name": "@praxisui/table",
3
- "version": "8.0.0-beta.57",
3
+ "version": "8.0.0-beta.59",
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.57",
9
- "@praxisui/core": "^8.0.0-beta.57",
10
- "@praxisui/dynamic-fields": "^8.0.0-beta.57",
11
- "@praxisui/dynamic-form": "^8.0.0-beta.57",
12
- "@praxisui/metadata-editor": "^8.0.0-beta.57",
13
- "@praxisui/rich-content": "^8.0.0-beta.57",
14
- "@praxisui/settings-panel": "^8.0.0-beta.57",
15
- "@praxisui/table-rule-builder": "^8.0.0-beta.57",
8
+ "@praxisui/ai": "^8.0.0-beta.59",
9
+ "@praxisui/core": "^8.0.0-beta.59",
10
+ "@praxisui/dynamic-fields": "^8.0.0-beta.59",
11
+ "@praxisui/dynamic-form": "^8.0.0-beta.59",
12
+ "@praxisui/metadata-editor": "^8.0.0-beta.59",
13
+ "@praxisui/rich-content": "^8.0.0-beta.59",
14
+ "@praxisui/settings-panel": "^8.0.0-beta.59",
15
+ "@praxisui/table-rule-builder": "^8.0.0-beta.59",
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.57",
20
+ "@praxisui/dialog": "^8.0.0-beta.59",
21
21
  "rxjs": "~7.8.0"
22
22
  },
23
23
  "dependencies": {