@praxisui/page-builder 9.0.0-beta.88 → 9.0.0-beta.90
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,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": "1.0.0",
|
|
3
|
-
"generatedAt": "2026-07-
|
|
3
|
+
"generatedAt": "2026-07-24T12:32:39.440Z",
|
|
4
4
|
"packageName": "@praxisui/page-builder",
|
|
5
|
-
"packageVersion": "9.0.0-beta.
|
|
5
|
+
"packageVersion": "9.0.0-beta.90",
|
|
6
6
|
"sourceRegistry": "praxis-component-registry-ingestion",
|
|
7
7
|
"sourceRegistryVersion": "1.0.0",
|
|
8
8
|
"componentCount": 1,
|
|
@@ -2939,6 +2939,10 @@ const PRAXIS_PAGE_BUILDER_EN_US = {
|
|
|
2939
2939
|
'praxis.pageBuilder.agentic.projectKnowledgeCockpit.timelineEmpty': 'No safe events have been published for this proposal yet.',
|
|
2940
2940
|
'praxis.pageBuilder.agentic.projectKnowledgeCockpit.rejected': 'Proposal rejected. No governed knowledge change was applied.',
|
|
2941
2941
|
'praxis.pageBuilder.agentic.errors.applyLocal': 'Preview could not be applied.',
|
|
2942
|
+
'praxis.pageBuilder.agentic.clientAction.undoApplied': 'I undid only the latest local change and preserved the earlier ones.',
|
|
2943
|
+
'praxis.pageBuilder.agentic.clientAction.undoUnavailable': 'There is no local change available to undo on this page.',
|
|
2944
|
+
'praxis.pageBuilder.agentic.errors.clientActionNotAuthorized': 'The requested local action is unavailable or does not match this page’s capabilities.',
|
|
2945
|
+
'praxis.pageBuilder.agentic.errors.clientActionExecution': 'The requested local action could not be executed.',
|
|
2942
2946
|
'praxis.pageBuilder.agentic.errors.componentId': 'Configure a component id before saving.',
|
|
2943
2947
|
'praxis.pageBuilder.agentic.errors.invalidPreview': 'Generated preview is invalid.',
|
|
2944
2948
|
'praxis.pageBuilder.agentic.errors.invalidPreviewWithDetails': 'I could not build a safe preview. Review the request or choose another data source.',
|
|
@@ -3560,6 +3564,10 @@ const PRAXIS_PAGE_BUILDER_PT_BR = {
|
|
|
3560
3564
|
'praxis.pageBuilder.agentic.projectKnowledgeCockpit.timelineEmpty': 'Ainda não há eventos seguros publicados para esta proposta.',
|
|
3561
3565
|
'praxis.pageBuilder.agentic.projectKnowledgeCockpit.rejected': 'Proposta rejeitada. Nenhuma alteração no conhecimento governado foi aplicada.',
|
|
3562
3566
|
'praxis.pageBuilder.agentic.errors.applyLocal': 'A pré-visualização não pôde ser aplicada.',
|
|
3567
|
+
'praxis.pageBuilder.agentic.clientAction.undoApplied': 'Desfiz somente a última alteração local e preservei as anteriores.',
|
|
3568
|
+
'praxis.pageBuilder.agentic.clientAction.undoUnavailable': 'Não há uma alteração local disponível para desfazer nesta página.',
|
|
3569
|
+
'praxis.pageBuilder.agentic.errors.clientActionNotAuthorized': 'A ação local solicitada não está disponível ou não corresponde às capacidades desta página.',
|
|
3570
|
+
'praxis.pageBuilder.agentic.errors.clientActionExecution': 'Não foi possível executar a ação local solicitada.',
|
|
3563
3571
|
'praxis.pageBuilder.agentic.errors.componentId': 'Configure um id de componente antes de salvar.',
|
|
3564
3572
|
'praxis.pageBuilder.agentic.errors.invalidPreview': 'A pré-visualização gerada é inválida.',
|
|
3565
3573
|
'praxis.pageBuilder.agentic.errors.invalidPreviewWithDetails': 'Não consegui montar uma prévia segura. Revise o pedido ou escolha outra fonte de dados.',
|
|
@@ -15297,6 +15305,10 @@ class PageBuilderAgenticAuthoringTurnFlow {
|
|
|
15297
15305
|
const componentCapabilities = await this.context.loadComponentCapabilities();
|
|
15298
15306
|
const selectedWidgetKey = this.context.selectedWidgetKey();
|
|
15299
15307
|
const intentResolution = await firstValueFrom(this.service.resolveIntent(this.buildIntentResolutionRequest(prompt, selectedWidgetKey, componentCapabilities, authoringContext)));
|
|
15308
|
+
const clientActionResult = await this.completeSemanticClientAction(intentResolution);
|
|
15309
|
+
if (clientActionResult) {
|
|
15310
|
+
return clientActionResult;
|
|
15311
|
+
}
|
|
15300
15312
|
const intentQuickReplies = this.resolveShellQuickReplies(intentResolution);
|
|
15301
15313
|
const intentAssistantMessage = this.normalizeAssistantMessageForQuickReplies(this.resolveIntentAssistantMessage(intentResolution), intentQuickReplies);
|
|
15302
15314
|
if (intentAssistantMessage) {
|
|
@@ -15610,11 +15622,14 @@ class PageBuilderAgenticAuthoringTurnFlow {
|
|
|
15610
15622
|
const status = this.decorateDashboardReviewStatus(this.context.describePreviewStatus(preview), intentResolution, preview);
|
|
15611
15623
|
const reviewCanApply = false;
|
|
15612
15624
|
const localReviewDiagnostics = this.buildLocalReviewDiagnostics(intentResolution, preview);
|
|
15625
|
+
const repairReplies = this.reviewQuickReplies([], intentResolution, preview);
|
|
15613
15626
|
return {
|
|
15614
15627
|
state: 'review',
|
|
15615
15628
|
phase: 'review',
|
|
15616
15629
|
assistantMessage: status,
|
|
15617
|
-
quickReplies:
|
|
15630
|
+
quickReplies: repairReplies.length
|
|
15631
|
+
? repairReplies
|
|
15632
|
+
: [this.dashboardQualityFallbackQuickReply(intentResolution, preview)],
|
|
15618
15633
|
canApply: reviewCanApply,
|
|
15619
15634
|
statusText: this.reviewStatusText(status, reviewCanApply),
|
|
15620
15635
|
errorText: '',
|
|
@@ -17070,6 +17085,10 @@ class PageBuilderAgenticAuthoringTurnFlow {
|
|
|
17070
17085
|
const assistantContent = this.toJsonObject(payload['assistantContent'])
|
|
17071
17086
|
?? this.toJsonObject(intentResolution.assistantContent)
|
|
17072
17087
|
?? null;
|
|
17088
|
+
const clientAction = this.normalizeClientAction(payload['clientAction']);
|
|
17089
|
+
if (clientAction) {
|
|
17090
|
+
return this.completeDeclaredClientAction(clientAction, intentResolution);
|
|
17091
|
+
}
|
|
17073
17092
|
const backendCanApply = payload['canApply'] === true && !!preview?.valid;
|
|
17074
17093
|
const terminalMaterializationIncomplete = backendCanApply
|
|
17075
17094
|
&& !this.hasCompiledPagePatch(preview);
|
|
@@ -18098,7 +18117,6 @@ class PageBuilderAgenticAuthoringTurnFlow {
|
|
|
18098
18117
|
governedBlockedReviewQuickReplies(quickReplies, intentResolution, preview) {
|
|
18099
18118
|
const replies = this.reviewQuickReplies(quickReplies, intentResolution, preview);
|
|
18100
18119
|
if (intentResolution.artifactKind === 'dashboard'
|
|
18101
|
-
&& !this.dashboardReviewCanApply(intentResolution, preview)
|
|
18102
18120
|
&& replies.length === 0) {
|
|
18103
18121
|
return [this.dashboardQualityFallbackQuickReply(intentResolution, preview)];
|
|
18104
18122
|
}
|
|
@@ -18381,6 +18399,7 @@ class PageBuilderAgenticAuthoringTurnFlow {
|
|
|
18381
18399
|
contextHints: {
|
|
18382
18400
|
source: 'dashboard-quality-gate',
|
|
18383
18401
|
kind: 'dashboard-repair-action',
|
|
18402
|
+
requiresBackendTerminalResult: true,
|
|
18384
18403
|
artifactKind: 'dashboard',
|
|
18385
18404
|
resourcePath,
|
|
18386
18405
|
warnings,
|
|
@@ -18999,6 +19018,9 @@ class PageBuilderAgenticAuthoringTurnFlow {
|
|
|
18999
19018
|
}
|
|
19000
19019
|
isContextualPreviewActionContext(contextHints) {
|
|
19001
19020
|
const hints = contextHints ?? null;
|
|
19021
|
+
if (hints?.['requiresBackendTerminalResult'] === true) {
|
|
19022
|
+
return false;
|
|
19023
|
+
}
|
|
19002
19024
|
const hintSource = this.readString(hints, 'source');
|
|
19003
19025
|
const hintKind = this.readString(hints, 'kind');
|
|
19004
19026
|
return hintSource === 'component-capability-catalog'
|
|
@@ -19849,15 +19871,149 @@ class PageBuilderAgenticAuthoringTurnFlow {
|
|
|
19849
19871
|
componentType: 'page-builder',
|
|
19850
19872
|
componentLabel: 'page builder',
|
|
19851
19873
|
});
|
|
19874
|
+
const clientActions = (this.context.clientActions?.() ?? [])
|
|
19875
|
+
.slice(0, 20)
|
|
19876
|
+
.map((action) => ({ ...action }));
|
|
19877
|
+
const contextualBase = clientActions.length
|
|
19878
|
+
? { ...scopedBase, clientActions }
|
|
19879
|
+
: scopedBase;
|
|
19852
19880
|
const includeLlmDiagnostics = this.context.includeLlmDiagnostics?.() === true;
|
|
19853
19881
|
if (!includeLlmDiagnostics) {
|
|
19854
|
-
return
|
|
19882
|
+
return contextualBase;
|
|
19855
19883
|
}
|
|
19856
19884
|
return {
|
|
19857
|
-
...
|
|
19885
|
+
...contextualBase,
|
|
19858
19886
|
includeLlmDiagnostics: true,
|
|
19859
19887
|
};
|
|
19860
19888
|
}
|
|
19889
|
+
async completeSemanticClientAction(intentResolution) {
|
|
19890
|
+
if (intentResolution.operationKind !== 'undo'
|
|
19891
|
+
|| intentResolution.changeKind !== 'undo_last_local_change') {
|
|
19892
|
+
return null;
|
|
19893
|
+
}
|
|
19894
|
+
const declared = (this.context.clientActions?.() ?? [])
|
|
19895
|
+
.find((action) => action.kind === 'local-undo'
|
|
19896
|
+
&& action.targetComponentId === this.context.targetComponentId);
|
|
19897
|
+
if (!declared?.available) {
|
|
19898
|
+
return {
|
|
19899
|
+
state: 'success',
|
|
19900
|
+
phase: 'summarize',
|
|
19901
|
+
assistantMessage: this.context.tx('agentic.clientAction.undoUnavailable', 'Não há uma alteração local disponível para desfazer nesta página.'),
|
|
19902
|
+
quickReplies: [],
|
|
19903
|
+
canApply: false,
|
|
19904
|
+
statusText: '',
|
|
19905
|
+
errorText: '',
|
|
19906
|
+
preview: null,
|
|
19907
|
+
diagnostics: {
|
|
19908
|
+
intentResolution,
|
|
19909
|
+
clientAction: {
|
|
19910
|
+
kind: 'local-undo',
|
|
19911
|
+
declared: !!declared,
|
|
19912
|
+
available: false,
|
|
19913
|
+
},
|
|
19914
|
+
},
|
|
19915
|
+
};
|
|
19916
|
+
}
|
|
19917
|
+
return this.executeDeclaredClientAction(declared, intentResolution);
|
|
19918
|
+
}
|
|
19919
|
+
async completeDeclaredClientAction(requested, intentResolution) {
|
|
19920
|
+
const declared = (this.context.clientActions?.() ?? []).find((action) => action.schemaVersion === requested.schemaVersion
|
|
19921
|
+
&& action.id === requested.id
|
|
19922
|
+
&& action.kind === requested.kind
|
|
19923
|
+
&& action.capabilityRef === requested.capabilityRef
|
|
19924
|
+
&& action.available
|
|
19925
|
+
&& requested.available
|
|
19926
|
+
&& action.targetComponentId === requested.targetComponentId
|
|
19927
|
+
&& action.targetComponentId === this.context.targetComponentId);
|
|
19928
|
+
if (!declared || !this.context.executeClientAction) {
|
|
19929
|
+
const message = this.context.tx('agentic.errors.clientActionNotAuthorized', 'A ação local solicitada não está disponível ou não corresponde às capacidades desta página.');
|
|
19930
|
+
return {
|
|
19931
|
+
state: 'error',
|
|
19932
|
+
phase: 'summarize',
|
|
19933
|
+
assistantMessage: message,
|
|
19934
|
+
canApply: false,
|
|
19935
|
+
statusText: '',
|
|
19936
|
+
errorText: message,
|
|
19937
|
+
preview: null,
|
|
19938
|
+
diagnostics: {
|
|
19939
|
+
intentResolution,
|
|
19940
|
+
clientAction: {
|
|
19941
|
+
id: requested.id,
|
|
19942
|
+
kind: requested.kind,
|
|
19943
|
+
authorized: false,
|
|
19944
|
+
},
|
|
19945
|
+
},
|
|
19946
|
+
};
|
|
19947
|
+
}
|
|
19948
|
+
return this.executeDeclaredClientAction(declared, intentResolution);
|
|
19949
|
+
}
|
|
19950
|
+
async executeDeclaredClientAction(action, intentResolution) {
|
|
19951
|
+
const executed = await this.context.executeClientAction(action);
|
|
19952
|
+
if (!executed.success) {
|
|
19953
|
+
const message = executed.error || this.context.tx('agentic.errors.clientActionExecution', 'Não foi possível executar a ação local solicitada.');
|
|
19954
|
+
return {
|
|
19955
|
+
state: 'error',
|
|
19956
|
+
phase: 'summarize',
|
|
19957
|
+
assistantMessage: message,
|
|
19958
|
+
canApply: false,
|
|
19959
|
+
statusText: '',
|
|
19960
|
+
errorText: message,
|
|
19961
|
+
preview: null,
|
|
19962
|
+
diagnostics: {
|
|
19963
|
+
intentResolution,
|
|
19964
|
+
clientAction: {
|
|
19965
|
+
id: action.id,
|
|
19966
|
+
kind: action.kind,
|
|
19967
|
+
authorized: true,
|
|
19968
|
+
executed: false,
|
|
19969
|
+
},
|
|
19970
|
+
},
|
|
19971
|
+
};
|
|
19972
|
+
}
|
|
19973
|
+
return {
|
|
19974
|
+
state: 'success',
|
|
19975
|
+
phase: 'summarize',
|
|
19976
|
+
assistantMessage: this.context.tx('agentic.clientAction.undoApplied', 'Desfiz somente a última alteração local e preservei as anteriores.'),
|
|
19977
|
+
quickReplies: [],
|
|
19978
|
+
canApply: false,
|
|
19979
|
+
statusText: '',
|
|
19980
|
+
errorText: '',
|
|
19981
|
+
preview: null,
|
|
19982
|
+
pendingPatch: null,
|
|
19983
|
+
diagnostics: {
|
|
19984
|
+
intentResolution,
|
|
19985
|
+
clientAction: {
|
|
19986
|
+
id: action.id,
|
|
19987
|
+
kind: action.kind,
|
|
19988
|
+
authorized: true,
|
|
19989
|
+
executed: true,
|
|
19990
|
+
},
|
|
19991
|
+
},
|
|
19992
|
+
};
|
|
19993
|
+
}
|
|
19994
|
+
normalizeClientAction(value) {
|
|
19995
|
+
const action = this.toJsonObject(value);
|
|
19996
|
+
const schemaVersion = this.readString(action ?? {}, 'schemaVersion');
|
|
19997
|
+
const id = this.readString(action ?? {}, 'id');
|
|
19998
|
+
const kind = this.readString(action ?? {}, 'kind');
|
|
19999
|
+
const capabilityRef = this.readString(action ?? {}, 'capabilityRef');
|
|
20000
|
+
const targetComponentId = this.readString(action ?? {}, 'targetComponentId');
|
|
20001
|
+
if (schemaVersion !== 'praxis-agentic-authoring-client-action.v1'
|
|
20002
|
+
|| !id
|
|
20003
|
+
|| kind !== 'local-undo'
|
|
20004
|
+
|| !capabilityRef
|
|
20005
|
+
|| action?.['available'] !== true) {
|
|
20006
|
+
return null;
|
|
20007
|
+
}
|
|
20008
|
+
return {
|
|
20009
|
+
schemaVersion,
|
|
20010
|
+
id,
|
|
20011
|
+
kind,
|
|
20012
|
+
capabilityRef,
|
|
20013
|
+
available: true,
|
|
20014
|
+
targetComponentId,
|
|
20015
|
+
};
|
|
20016
|
+
}
|
|
19861
20017
|
withoutAgenticApplyTarget(contextHints) {
|
|
19862
20018
|
if (!contextHints || !Object.prototype.hasOwnProperty.call(contextHints, 'agenticApplyTarget')) {
|
|
19863
20019
|
return contextHints;
|
|
@@ -20145,6 +20301,7 @@ function projectKnowledgeTarget(changeSet, conceptKey) {
|
|
|
20145
20301
|
}
|
|
20146
20302
|
|
|
20147
20303
|
const AGENTIC_AUTHORING_TURN_INACTIVITY_TIMEOUT_MS = 180_000;
|
|
20304
|
+
const AGENTIC_LOCAL_PREVIEW_HISTORY_LIMIT = 20;
|
|
20148
20305
|
const AGENTIC_PAGE_COMPOSITION_REQUEST_OUTPUT = 'agenticPageCompositionRequested';
|
|
20149
20306
|
class DynamicPageBuilderComponent {
|
|
20150
20307
|
dialog;
|
|
@@ -20251,6 +20408,8 @@ class DynamicPageBuilderComponent {
|
|
|
20251
20408
|
agenticComponentCapabilities;
|
|
20252
20409
|
agenticComponentCapabilitiesPromise;
|
|
20253
20410
|
agenticTurnController;
|
|
20411
|
+
agenticLocalPreviewHistory = [];
|
|
20412
|
+
agenticLocalPreviewHistoryTruncated = false;
|
|
20254
20413
|
agenticTurnCancel$ = new Subject();
|
|
20255
20414
|
agenticTurnRunId = 0;
|
|
20256
20415
|
agenticAuthoringTurnInactivityTimeoutMs = AGENTIC_AUTHORING_TURN_INACTIVITY_TIMEOUT_MS;
|
|
@@ -21047,6 +21206,7 @@ class DynamicPageBuilderComponent {
|
|
|
21047
21206
|
this.agenticAuthoringError.set('');
|
|
21048
21207
|
this.agenticAuthoringPreviewResult.set(null);
|
|
21049
21208
|
this.agenticAuthoringMaterializationPending.set(false);
|
|
21209
|
+
this.clearAgenticLocalPreviewHistory();
|
|
21050
21210
|
this.agenticAuthoringSemanticDecision.set(null);
|
|
21051
21211
|
this.agenticAuthoringSemanticResourcePresentationLabel.set(null);
|
|
21052
21212
|
this.agenticAuthoringTurnResultRef.set(null);
|
|
@@ -22023,6 +22183,7 @@ class DynamicPageBuilderComponent {
|
|
|
22023
22183
|
this.agenticAuthoringApplied.emit(result);
|
|
22024
22184
|
this.agenticAuthoringPreviewResult.set(null);
|
|
22025
22185
|
this.agenticAuthoringMaterializationPending.set(false);
|
|
22186
|
+
this.clearAgenticLocalPreviewHistory();
|
|
22026
22187
|
this.agenticAuthoringSemanticDecision.set(null);
|
|
22027
22188
|
this.agenticAuthoringTurnResultRef.set(null);
|
|
22028
22189
|
this.agenticAuthoringApplyTarget.set(null);
|
|
@@ -22909,6 +23070,8 @@ class DynamicPageBuilderComponent {
|
|
|
22909
23070
|
matchesApplyTarget: (target) => this.matchesCurrentAgenticApplyTarget(target),
|
|
22910
23071
|
enableTurnStream: () => this.agenticAuthoringEnableStreaming,
|
|
22911
23072
|
includeLlmDiagnostics: () => this.agenticAuthoringIncludeLlmDiagnostics,
|
|
23073
|
+
clientActions: () => [this.agenticLocalUndoAction()],
|
|
23074
|
+
executeClientAction: (action) => this.executeAgenticClientAction(action),
|
|
22912
23075
|
collectRuntimeComponentObservations: () => this.collectRuntimeComponentObservationsForAgenticTurn(),
|
|
22913
23076
|
resolveSelectedComponentAuthoringContext: (widgetKey) => this.resolveSelectedComponentAuthoringContext(widgetKey),
|
|
22914
23077
|
loadComponentCapabilities: () => this.loadAgenticComponentCapabilities(),
|
|
@@ -22934,18 +23097,24 @@ class DynamicPageBuilderComponent {
|
|
|
22934
23097
|
}
|
|
22935
23098
|
async applyAgenticPreviewLocally(result) {
|
|
22936
23099
|
const adapter = new PageBuilderAiAdapter(this.createAdapterHost(), this.componentMetadata);
|
|
23100
|
+
const snapshot = adapter.createSnapshot();
|
|
22937
23101
|
const applied = await (result.compiledFormPatch?.patch?.page
|
|
22938
23102
|
? adapter.applyCompiledFormPatch(result.compiledFormPatch)
|
|
22939
23103
|
: result.uiCompositionPlan
|
|
22940
23104
|
? adapter.applyUiCompositionPlan(result.uiCompositionPlan)
|
|
22941
23105
|
: adapter.applyCompiledFormPatch(result.compiledFormPatch));
|
|
22942
23106
|
if (!applied.success && this.isAgenticTableContractError(applied.error)) {
|
|
23107
|
+
await adapter.restoreSnapshot(snapshot);
|
|
22943
23108
|
return {
|
|
22944
23109
|
...applied,
|
|
22945
23110
|
error: this.tx('agentic.errors.invalidTableContract', 'Encontrei a fonte de dados, mas a tabela proposta usa informações que esse componente não aceita. Vou ajustar para usar apenas campos compatíveis.'),
|
|
22946
23111
|
};
|
|
22947
23112
|
}
|
|
23113
|
+
if (!applied.success) {
|
|
23114
|
+
await adapter.restoreSnapshot(snapshot);
|
|
23115
|
+
}
|
|
22948
23116
|
if (applied.success) {
|
|
23117
|
+
this.recordAgenticLocalPreview(snapshot);
|
|
22949
23118
|
this.agenticAuthoringMaterializationPending.set(true);
|
|
22950
23119
|
if (this.enableCustomization) {
|
|
22951
23120
|
this.enterPreviewMode();
|
|
@@ -22953,6 +23122,81 @@ class DynamicPageBuilderComponent {
|
|
|
22953
23122
|
}
|
|
22954
23123
|
return applied;
|
|
22955
23124
|
}
|
|
23125
|
+
agenticLocalUndoAction() {
|
|
23126
|
+
return {
|
|
23127
|
+
schemaVersion: 'praxis-agentic-authoring-client-action.v1',
|
|
23128
|
+
id: 'page-builder.local-preview.undo',
|
|
23129
|
+
kind: 'local-undo',
|
|
23130
|
+
capabilityRef: 'page-builder.local-preview-history',
|
|
23131
|
+
available: this.canUndoAgenticLocalPreview(),
|
|
23132
|
+
targetComponentId: 'praxis-dynamic-page-builder',
|
|
23133
|
+
};
|
|
23134
|
+
}
|
|
23135
|
+
async executeAgenticClientAction(action) {
|
|
23136
|
+
if (action.kind !== 'local-undo'
|
|
23137
|
+
|| action.id !== 'page-builder.local-preview.undo'
|
|
23138
|
+
|| action.capabilityRef !== 'page-builder.local-preview-history'
|
|
23139
|
+
|| action.targetComponentId !== 'praxis-dynamic-page-builder') {
|
|
23140
|
+
return {
|
|
23141
|
+
success: false,
|
|
23142
|
+
error: this.tx('agentic.errors.clientActionNotAuthorized', 'A ação local solicitada não corresponde às capacidades desta página.'),
|
|
23143
|
+
};
|
|
23144
|
+
}
|
|
23145
|
+
return this.undoAgenticLocalPreview();
|
|
23146
|
+
}
|
|
23147
|
+
canUndoAgenticLocalPreview() {
|
|
23148
|
+
const latest = this.agenticLocalPreviewHistory.at(-1);
|
|
23149
|
+
return !!latest
|
|
23150
|
+
&& latest.componentId === this.resolveAgenticComponentId()
|
|
23151
|
+
&& latest.appliedPageFingerprint === this.agenticCurrentPageFingerprint();
|
|
23152
|
+
}
|
|
23153
|
+
async undoAgenticLocalPreview() {
|
|
23154
|
+
if (!this.canUndoAgenticLocalPreview()) {
|
|
23155
|
+
return {
|
|
23156
|
+
success: false,
|
|
23157
|
+
error: this.tx('agentic.clientAction.undoUnavailable', 'Não há uma alteração local disponível para desfazer nesta página.'),
|
|
23158
|
+
};
|
|
23159
|
+
}
|
|
23160
|
+
const entry = this.agenticLocalPreviewHistory.pop();
|
|
23161
|
+
const adapter = new PageBuilderAiAdapter(this.createAdapterHost(), this.componentMetadata);
|
|
23162
|
+
try {
|
|
23163
|
+
await adapter.restoreSnapshot(entry.snapshot);
|
|
23164
|
+
this.agenticAuthoringMaterializationPending.set(this.agenticLocalPreviewHistoryTruncated || this.agenticLocalPreviewHistory.length > 0);
|
|
23165
|
+
if (this.enableCustomization) {
|
|
23166
|
+
this.enterPreviewMode();
|
|
23167
|
+
}
|
|
23168
|
+
return { success: true };
|
|
23169
|
+
}
|
|
23170
|
+
catch (error) {
|
|
23171
|
+
this.agenticLocalPreviewHistory.push(entry);
|
|
23172
|
+
return {
|
|
23173
|
+
success: false,
|
|
23174
|
+
error: this.describeAgenticError(error),
|
|
23175
|
+
};
|
|
23176
|
+
}
|
|
23177
|
+
}
|
|
23178
|
+
recordAgenticLocalPreview(snapshot) {
|
|
23179
|
+
const componentId = this.resolveAgenticComponentId();
|
|
23180
|
+
if (!componentId) {
|
|
23181
|
+
return;
|
|
23182
|
+
}
|
|
23183
|
+
this.agenticLocalPreviewHistory.push({
|
|
23184
|
+
componentId,
|
|
23185
|
+
snapshot,
|
|
23186
|
+
appliedPageFingerprint: this.agenticCurrentPageFingerprint(),
|
|
23187
|
+
});
|
|
23188
|
+
if (this.agenticLocalPreviewHistory.length > AGENTIC_LOCAL_PREVIEW_HISTORY_LIMIT) {
|
|
23189
|
+
this.agenticLocalPreviewHistory.shift();
|
|
23190
|
+
this.agenticLocalPreviewHistoryTruncated = true;
|
|
23191
|
+
}
|
|
23192
|
+
}
|
|
23193
|
+
clearAgenticLocalPreviewHistory() {
|
|
23194
|
+
this.agenticLocalPreviewHistory.length = 0;
|
|
23195
|
+
this.agenticLocalPreviewHistoryTruncated = false;
|
|
23196
|
+
}
|
|
23197
|
+
agenticCurrentPageFingerprint() {
|
|
23198
|
+
return JSON.stringify(this.currentPage());
|
|
23199
|
+
}
|
|
22956
23200
|
enterPreviewMode() {
|
|
22957
23201
|
this.previewMode = true;
|
|
22958
23202
|
this.runtimePreviewPageCache = undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@praxisui/page-builder",
|
|
3
|
-
"version": "9.0.0-beta.
|
|
3
|
+
"version": "9.0.0-beta.90",
|
|
4
4
|
"description": "Page and widget builder utilities for Praxis UI (grid, dynamic widgets, editors).",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@angular/common": "^21.0.0",
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"@angular/forms": "^21.0.0",
|
|
9
9
|
"@angular/cdk": "^21.0.0",
|
|
10
10
|
"@angular/material": "^21.0.0",
|
|
11
|
-
"@praxisui/ai": "^9.0.0-beta.
|
|
12
|
-
"@praxisui/core": "^9.0.0-beta.
|
|
13
|
-
"@praxisui/settings-panel": "^9.0.0-beta.
|
|
11
|
+
"@praxisui/ai": "^9.0.0-beta.90",
|
|
12
|
+
"@praxisui/core": "^9.0.0-beta.90",
|
|
13
|
+
"@praxisui/settings-panel": "^9.0.0-beta.90",
|
|
14
14
|
"rxjs": "~7.8.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
@@ -1814,6 +1814,8 @@ declare class DynamicPageBuilderComponent implements OnChanges, OnDestroy {
|
|
|
1814
1814
|
private agenticComponentCapabilities?;
|
|
1815
1815
|
private agenticComponentCapabilitiesPromise?;
|
|
1816
1816
|
private agenticTurnController?;
|
|
1817
|
+
private readonly agenticLocalPreviewHistory;
|
|
1818
|
+
private agenticLocalPreviewHistoryTruncated;
|
|
1817
1819
|
private readonly agenticTurnCancel$;
|
|
1818
1820
|
private agenticTurnRunId;
|
|
1819
1821
|
private agenticAuthoringTurnInactivityTimeoutMs;
|
|
@@ -1998,6 +2000,13 @@ declare class DynamicPageBuilderComponent implements OnChanges, OnDestroy {
|
|
|
1998
2000
|
private isComponentConfigEditorContextResult;
|
|
1999
2001
|
private ensureAgenticTurnController;
|
|
2000
2002
|
private applyAgenticPreviewLocally;
|
|
2003
|
+
private agenticLocalUndoAction;
|
|
2004
|
+
private executeAgenticClientAction;
|
|
2005
|
+
private canUndoAgenticLocalPreview;
|
|
2006
|
+
private undoAgenticLocalPreview;
|
|
2007
|
+
private recordAgenticLocalPreview;
|
|
2008
|
+
private clearAgenticLocalPreviewHistory;
|
|
2009
|
+
private agenticCurrentPageFingerprint;
|
|
2001
2010
|
private enterPreviewMode;
|
|
2002
2011
|
private toPresentationRuntimePage;
|
|
2003
2012
|
private toAuthoringRuntimePage;
|