@praxisui/page-builder 9.0.0-beta.75 → 9.0.0-beta.77
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/README.md
CHANGED
|
@@ -204,6 +204,8 @@ providers: [
|
|
|
204
204
|
|
|
205
205
|
The package exports `PRAXIS_PAGE_BUILDER_AUTHORING_MANIFEST` for governed operation discovery. The persisted runtime page is still `WidgetPageDefinition`; intermediate AI plans such as `UiCompositionPlan` must compile before preview, apply, or save.
|
|
206
206
|
|
|
207
|
+
Streaming apply is fail-closed. A preview is persistable only when it is the unchanged payload of an applicable terminal `result` event and its diagnostics carry the matching `streamId`, `threadId`, `turnId`, and `resultEventId`. A locally regenerated or normalized preview remains available for review, but it cannot reuse an older terminal reference or call `page-apply`; the backend must issue a new terminal result for the new patch.
|
|
208
|
+
|
|
207
209
|
## Public API
|
|
208
210
|
|
|
209
211
|
Main exports:
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": "1.0.0",
|
|
3
|
-
"generatedAt": "2026-07-
|
|
3
|
+
"generatedAt": "2026-07-17T21:08:00.571Z",
|
|
4
4
|
"packageName": "@praxisui/page-builder",
|
|
5
|
-
"packageVersion": "9.0.0-beta.
|
|
5
|
+
"packageVersion": "9.0.0-beta.77",
|
|
6
6
|
"sourceRegistry": "praxis-component-registry-ingestion",
|
|
7
7
|
"sourceRegistryVersion": "1.0.0",
|
|
8
8
|
"componentCount": 1,
|
|
@@ -15312,7 +15312,8 @@ class PageBuilderAgenticAuthoringTurnFlow {
|
|
|
15312
15312
|
};
|
|
15313
15313
|
}
|
|
15314
15314
|
const status = this.decorateDashboardReviewStatus(this.context.describePreviewStatus(preview), intentResolution, preview);
|
|
15315
|
-
const reviewCanApply =
|
|
15315
|
+
const reviewCanApply = false;
|
|
15316
|
+
const localReviewDiagnostics = this.buildLocalReviewDiagnostics(intentResolution, preview);
|
|
15316
15317
|
return {
|
|
15317
15318
|
state: 'review',
|
|
15318
15319
|
phase: 'review',
|
|
@@ -15324,7 +15325,7 @@ class PageBuilderAgenticAuthoringTurnFlow {
|
|
|
15324
15325
|
statusText: this.reviewStatusText(status, reviewCanApply),
|
|
15325
15326
|
errorText: '',
|
|
15326
15327
|
preview,
|
|
15327
|
-
diagnostics:
|
|
15328
|
+
diagnostics: localReviewDiagnostics,
|
|
15328
15329
|
};
|
|
15329
15330
|
}
|
|
15330
15331
|
catch (error) {
|
|
@@ -15476,7 +15477,8 @@ class PageBuilderAgenticAuthoringTurnFlow {
|
|
|
15476
15477
|
};
|
|
15477
15478
|
}
|
|
15478
15479
|
const status = this.decorateDashboardReviewStatus(this.context.describePreviewStatus(preview), intentResolution, preview);
|
|
15479
|
-
const reviewCanApply =
|
|
15480
|
+
const reviewCanApply = false;
|
|
15481
|
+
const localReviewDiagnostics = this.buildLocalReviewDiagnostics(intentResolution, preview);
|
|
15480
15482
|
return {
|
|
15481
15483
|
state: 'review',
|
|
15482
15484
|
phase: 'review',
|
|
@@ -15486,7 +15488,7 @@ class PageBuilderAgenticAuthoringTurnFlow {
|
|
|
15486
15488
|
statusText: this.reviewStatusText(status, reviewCanApply),
|
|
15487
15489
|
errorText: '',
|
|
15488
15490
|
preview,
|
|
15489
|
-
diagnostics:
|
|
15491
|
+
diagnostics: localReviewDiagnostics,
|
|
15490
15492
|
};
|
|
15491
15493
|
}
|
|
15492
15494
|
buildLocalDashboardRepairPreview(prompt, contextHints, intentResolution) {
|
|
@@ -16711,6 +16713,13 @@ class PageBuilderAgenticAuthoringTurnFlow {
|
|
|
16711
16713
|
const runtimeObservationsStartedAt = Date.now();
|
|
16712
16714
|
const runtimeObservationResult = await this.collectRuntimeComponentObservations(request);
|
|
16713
16715
|
const runtimeObservationsElapsedMs = Math.max(0, Date.now() - runtimeObservationsStartedAt);
|
|
16716
|
+
const applyTarget = this.context.applyTarget?.() ?? null;
|
|
16717
|
+
const streamContextHints = applyTarget
|
|
16718
|
+
? {
|
|
16719
|
+
...(authoringContext.contextHints ?? {}),
|
|
16720
|
+
agenticApplyTarget: applyTarget,
|
|
16721
|
+
}
|
|
16722
|
+
: authoringContext.contextHints ?? undefined;
|
|
16714
16723
|
const streamRequest = {
|
|
16715
16724
|
userPrompt: prompt,
|
|
16716
16725
|
targetApp: this.context.targetApp,
|
|
@@ -16722,6 +16731,7 @@ class PageBuilderAgenticAuthoringTurnFlow {
|
|
|
16722
16731
|
model: this.context.model(),
|
|
16723
16732
|
apiKey: this.context.apiKey(),
|
|
16724
16733
|
...authoringContext,
|
|
16734
|
+
contextHints: streamContextHints,
|
|
16725
16735
|
...(this.runtimeRelatedSurfaceDisambiguationContext
|
|
16726
16736
|
? {
|
|
16727
16737
|
diagnostics: {
|
|
@@ -16747,7 +16757,7 @@ class PageBuilderAgenticAuthoringTurnFlow {
|
|
|
16747
16757
|
runtimeObservationsElapsedMs,
|
|
16748
16758
|
attachmentCount: authoringContext.attachmentSummaries?.length ?? 0,
|
|
16749
16759
|
hasPendingClarification: !!authoringContext.pendingClarification,
|
|
16750
|
-
hasContextHints: !!
|
|
16760
|
+
hasContextHints: !!streamContextHints,
|
|
16751
16761
|
hasSelectedComponentValidationContext: !!this.toJsonObject(authoringContext.contextHints?.['validationContext']),
|
|
16752
16762
|
selectedComponentContextDiagnosticCount: Array.isArray(authoringContext.contextHints?.['contextDiagnostics'])
|
|
16753
16763
|
? authoringContext.contextHints['contextDiagnostics'].length
|
|
@@ -16867,21 +16877,52 @@ class PageBuilderAgenticAuthoringTurnFlow {
|
|
|
16867
16877
|
const assistantContent = this.toJsonObject(payload['assistantContent'])
|
|
16868
16878
|
?? this.toJsonObject(intentResolution.assistantContent)
|
|
16869
16879
|
?? null;
|
|
16870
|
-
const
|
|
16880
|
+
const backendCanApply = payload['canApply'] === true && !!preview?.valid;
|
|
16881
|
+
const terminalMaterializationIncomplete = backendCanApply
|
|
16882
|
+
&& !this.hasCompiledPagePatch(preview);
|
|
16883
|
+
const terminalApplyTarget = this.applyTargetFromTerminalPayload(payload);
|
|
16884
|
+
const terminalApplyTargetIncomplete = backendCanApply && !terminalApplyTarget;
|
|
16885
|
+
const terminalApplyTargetMismatch = backendCanApply
|
|
16886
|
+
&& !!terminalApplyTarget
|
|
16887
|
+
&& !this.matchesCurrentApplyTarget(terminalApplyTarget);
|
|
16888
|
+
const terminalTurnResultRef = backendCanApply
|
|
16889
|
+
&& !terminalMaterializationIncomplete
|
|
16890
|
+
&& !terminalApplyTargetIncomplete
|
|
16891
|
+
&& !terminalApplyTargetMismatch
|
|
16892
|
+
? this.turnResultRefFromStreamEvent(event)
|
|
16893
|
+
: null;
|
|
16894
|
+
const terminalReferenceIncomplete = backendCanApply
|
|
16895
|
+
&& !terminalMaterializationIncomplete
|
|
16896
|
+
&& !terminalApplyTargetIncomplete
|
|
16897
|
+
&& !terminalApplyTargetMismatch
|
|
16898
|
+
&& !terminalTurnResultRef;
|
|
16899
|
+
const canApply = backendCanApply
|
|
16900
|
+
&& !terminalMaterializationIncomplete
|
|
16901
|
+
&& !terminalApplyTargetIncomplete
|
|
16902
|
+
&& !terminalApplyTargetMismatch
|
|
16903
|
+
&& !terminalReferenceIncomplete;
|
|
16904
|
+
const streamResultDiagnostics = this.buildStreamResultDiagnostics(intentResolution, preview, payload, terminalTurnResultRef, terminalApplyTarget, backendCanApply
|
|
16905
|
+
? terminalMaterializationIncomplete
|
|
16906
|
+
? 'terminal-materialization-incomplete'
|
|
16907
|
+
: terminalApplyTargetIncomplete
|
|
16908
|
+
? 'terminal-apply-target-incomplete'
|
|
16909
|
+
: terminalApplyTargetMismatch
|
|
16910
|
+
? 'terminal-apply-target-mismatch'
|
|
16911
|
+
: terminalReferenceIncomplete
|
|
16912
|
+
? 'terminal-reference-incomplete'
|
|
16913
|
+
: null
|
|
16914
|
+
: 'backend-not-applicable');
|
|
16871
16915
|
const contextualExecutableIntent = request
|
|
16872
16916
|
? this.toExecutableContextualComponentIntent(intentResolution, request)
|
|
16873
16917
|
: null;
|
|
16874
|
-
if (!
|
|
16918
|
+
if (!backendCanApply && contextualExecutableIntent && request && prompt) {
|
|
16875
16919
|
return this.completeExecutableStreamPreview(request, prompt, contextualExecutableIntent, preview, preparedContextHints);
|
|
16876
16920
|
}
|
|
16877
|
-
if (canApply
|
|
16878
|
-
&& request
|
|
16879
|
-
&& prompt
|
|
16880
|
-
&& this.shouldRegenerateStreamPreview(intentResolution, preview)) {
|
|
16881
|
-
return this.completeExecutableStreamPreview(request, prompt, intentResolution, undefined, preparedContextHints);
|
|
16882
|
-
}
|
|
16883
16921
|
if (!canApply) {
|
|
16884
|
-
if (preview
|
|
16922
|
+
if (preview
|
|
16923
|
+
&& this.hasMaterializablePreview(preview)
|
|
16924
|
+
&& !terminalApplyTargetMismatch
|
|
16925
|
+
&& ((backendCanApply && !canApply) || this.isGovernedBlockedStreamPreview(payload, preview))) {
|
|
16885
16926
|
const applied = await this.context.applyLocalPreview(preview);
|
|
16886
16927
|
if (!applied.success) {
|
|
16887
16928
|
const message = applied.error || this.context.tx('agentic.errors.applyLocal', 'Preview could not be applied.');
|
|
@@ -16893,11 +16934,7 @@ class PageBuilderAgenticAuthoringTurnFlow {
|
|
|
16893
16934
|
statusText: '',
|
|
16894
16935
|
errorText: message,
|
|
16895
16936
|
preview: null,
|
|
16896
|
-
diagnostics:
|
|
16897
|
-
...this.buildTurnDiagnostics(intentResolution, preview),
|
|
16898
|
-
decisionDiagnostics: this.toJsonObject(payload['decisionDiagnostics']),
|
|
16899
|
-
toolLoopTrace: Array.isArray(payload['toolLoopTrace']) ? payload['toolLoopTrace'] : undefined,
|
|
16900
|
-
},
|
|
16937
|
+
diagnostics: streamResultDiagnostics,
|
|
16901
16938
|
};
|
|
16902
16939
|
}
|
|
16903
16940
|
const status = this.decorateDashboardReviewStatus(assistantMessage || this.context.describePreviewStatus(preview), intentResolution, preview);
|
|
@@ -16910,11 +16947,21 @@ class PageBuilderAgenticAuthoringTurnFlow {
|
|
|
16910
16947
|
statusText: this.reviewStatusText(status, false),
|
|
16911
16948
|
errorText: '',
|
|
16912
16949
|
preview,
|
|
16913
|
-
diagnostics:
|
|
16914
|
-
|
|
16915
|
-
|
|
16916
|
-
|
|
16917
|
-
|
|
16950
|
+
diagnostics: streamResultDiagnostics,
|
|
16951
|
+
};
|
|
16952
|
+
}
|
|
16953
|
+
if (backendCanApply) {
|
|
16954
|
+
return {
|
|
16955
|
+
state: 'review',
|
|
16956
|
+
phase: 'review',
|
|
16957
|
+
assistantMessage,
|
|
16958
|
+
assistantContent,
|
|
16959
|
+
quickReplies: this.governedBlockedReviewQuickReplies(quickReplies, intentResolution, preview),
|
|
16960
|
+
canApply: false,
|
|
16961
|
+
statusText: this.reviewStatusText(assistantMessage, false),
|
|
16962
|
+
errorText: '',
|
|
16963
|
+
preview: preview ?? null,
|
|
16964
|
+
diagnostics: streamResultDiagnostics,
|
|
16918
16965
|
};
|
|
16919
16966
|
}
|
|
16920
16967
|
const pendingClarification = this.toShellPendingClarification(intentResolution?.pendingClarification)
|
|
@@ -16939,7 +16986,7 @@ class PageBuilderAgenticAuthoringTurnFlow {
|
|
|
16939
16986
|
errorText: '',
|
|
16940
16987
|
preview: null,
|
|
16941
16988
|
pendingClarification,
|
|
16942
|
-
diagnostics:
|
|
16989
|
+
diagnostics: streamResultDiagnostics,
|
|
16943
16990
|
};
|
|
16944
16991
|
}
|
|
16945
16992
|
const applied = await this.context.applyLocalPreview(preview);
|
|
@@ -16953,11 +17000,11 @@ class PageBuilderAgenticAuthoringTurnFlow {
|
|
|
16953
17000
|
statusText: '',
|
|
16954
17001
|
errorText: message,
|
|
16955
17002
|
preview: null,
|
|
16956
|
-
diagnostics:
|
|
17003
|
+
diagnostics: streamResultDiagnostics,
|
|
16957
17004
|
};
|
|
16958
17005
|
}
|
|
16959
17006
|
const status = this.decorateDashboardReviewStatus(this.context.describePreviewStatus(preview), intentResolution, preview);
|
|
16960
|
-
const reviewCanApply = this.reviewCanApply(intentResolution, preview);
|
|
17007
|
+
const reviewCanApply = canApply && this.reviewCanApply(intentResolution, preview);
|
|
16961
17008
|
return {
|
|
16962
17009
|
state: 'review',
|
|
16963
17010
|
phase: 'review',
|
|
@@ -16969,7 +17016,7 @@ class PageBuilderAgenticAuthoringTurnFlow {
|
|
|
16969
17016
|
statusText: this.reviewStatusText(status, reviewCanApply),
|
|
16970
17017
|
errorText: '',
|
|
16971
17018
|
preview,
|
|
16972
|
-
diagnostics:
|
|
17019
|
+
diagnostics: streamResultDiagnostics,
|
|
16973
17020
|
};
|
|
16974
17021
|
}
|
|
16975
17022
|
hasBlockingResourceQuickReply(quickReplies) {
|
|
@@ -17041,7 +17088,8 @@ class PageBuilderAgenticAuthoringTurnFlow {
|
|
|
17041
17088
|
};
|
|
17042
17089
|
}
|
|
17043
17090
|
const status = this.decorateDashboardReviewStatus(this.context.describePreviewStatus(preview), intentResolution, preview);
|
|
17044
|
-
const reviewCanApply =
|
|
17091
|
+
const reviewCanApply = false;
|
|
17092
|
+
const localReviewDiagnostics = this.buildLocalReviewDiagnostics(intentResolution, preview);
|
|
17045
17093
|
return {
|
|
17046
17094
|
state: 'review',
|
|
17047
17095
|
phase: 'review',
|
|
@@ -17053,7 +17101,7 @@ class PageBuilderAgenticAuthoringTurnFlow {
|
|
|
17053
17101
|
statusText: this.reviewStatusText(status, reviewCanApply),
|
|
17054
17102
|
errorText: '',
|
|
17055
17103
|
preview,
|
|
17056
|
-
diagnostics:
|
|
17104
|
+
diagnostics: localReviewDiagnostics,
|
|
17057
17105
|
};
|
|
17058
17106
|
}
|
|
17059
17107
|
catch (error) {
|
|
@@ -17082,6 +17130,65 @@ class PageBuilderAgenticAuthoringTurnFlow {
|
|
|
17082
17130
|
}
|
|
17083
17131
|
return true;
|
|
17084
17132
|
}
|
|
17133
|
+
turnResultRefFromStreamEvent(event) {
|
|
17134
|
+
if (!event || event.type !== 'result') {
|
|
17135
|
+
return null;
|
|
17136
|
+
}
|
|
17137
|
+
const streamId = `${event.streamId || ''}`.trim();
|
|
17138
|
+
const threadId = `${event.threadId || ''}`.trim();
|
|
17139
|
+
const turnId = `${event.turnId || ''}`.trim();
|
|
17140
|
+
const resultEventId = `${event.eventId || ''}`.trim();
|
|
17141
|
+
if (!streamId || !threadId || !turnId || !resultEventId) {
|
|
17142
|
+
return null;
|
|
17143
|
+
}
|
|
17144
|
+
return { streamId, threadId, turnId, resultEventId };
|
|
17145
|
+
}
|
|
17146
|
+
buildStreamResultDiagnostics(intentResolution, preview, payload, turnResultRef, applyTarget, blockReason) {
|
|
17147
|
+
return {
|
|
17148
|
+
...this.buildTurnDiagnostics(intentResolution, preview),
|
|
17149
|
+
decisionDiagnostics: this.toJsonObject(payload['decisionDiagnostics']),
|
|
17150
|
+
toolLoopTrace: Array.isArray(payload['toolLoopTrace']) ? payload['toolLoopTrace'] : undefined,
|
|
17151
|
+
...(turnResultRef ? { turnResultRef } : {}),
|
|
17152
|
+
...(applyTarget ? { applyTarget } : {}),
|
|
17153
|
+
applyLineage: {
|
|
17154
|
+
schemaVersion: 'praxis-agentic-authoring-apply-lineage.v1',
|
|
17155
|
+
status: turnResultRef ? 'terminal-result-reference-present' : 'blocked',
|
|
17156
|
+
reason: blockReason,
|
|
17157
|
+
patchAuthority: turnResultRef ? 'backend-terminal-result' : 'review-only',
|
|
17158
|
+
},
|
|
17159
|
+
};
|
|
17160
|
+
}
|
|
17161
|
+
applyTargetFromTerminalPayload(payload) {
|
|
17162
|
+
const candidate = this.toJsonObject(payload['applyTarget']);
|
|
17163
|
+
if (!candidate
|
|
17164
|
+
|| this.readString(candidate, 'schemaVersion') !== 'praxis-agentic-authoring-apply-target.v1'
|
|
17165
|
+
|| !this.readString(candidate, 'componentType')
|
|
17166
|
+
|| !this.readString(candidate, 'componentId')) {
|
|
17167
|
+
return null;
|
|
17168
|
+
}
|
|
17169
|
+
const scopeValue = this.readString(candidate, 'scope');
|
|
17170
|
+
const mode = this.readString(candidate, 'mode');
|
|
17171
|
+
const baseEtag = this.readString(candidate, 'baseEtag');
|
|
17172
|
+
if ((scopeValue !== 'user' && scopeValue !== 'tenant')
|
|
17173
|
+
|| (mode !== 'create' && mode !== 'update')
|
|
17174
|
+
|| (mode === 'update' && !baseEtag)
|
|
17175
|
+
|| (mode === 'create' && !!baseEtag)) {
|
|
17176
|
+
return null;
|
|
17177
|
+
}
|
|
17178
|
+
const scope = scopeValue;
|
|
17179
|
+
const common = {
|
|
17180
|
+
schemaVersion: 'praxis-agentic-authoring-apply-target.v1',
|
|
17181
|
+
componentType: this.readString(candidate, 'componentType'),
|
|
17182
|
+
componentId: this.readString(candidate, 'componentId'),
|
|
17183
|
+
scope,
|
|
17184
|
+
...(this.readString(candidate, 'environment')
|
|
17185
|
+
? { environment: this.readString(candidate, 'environment') }
|
|
17186
|
+
: {}),
|
|
17187
|
+
};
|
|
17188
|
+
return mode === 'update'
|
|
17189
|
+
? { ...common, mode, baseEtag: baseEtag }
|
|
17190
|
+
: { ...common, mode };
|
|
17191
|
+
}
|
|
17085
17192
|
isGovernedBlockedStreamPreview(payload, preview) {
|
|
17086
17193
|
const previewDiagnostics = this.toJsonObject(preview.diagnostics);
|
|
17087
17194
|
const decisionDiagnostics = this.toJsonObject(payload['decisionDiagnostics'])
|
|
@@ -17115,7 +17222,10 @@ class PageBuilderAgenticAuthoringTurnFlow {
|
|
|
17115
17222
|
if (preview.uiCompositionPlan) {
|
|
17116
17223
|
return true;
|
|
17117
17224
|
}
|
|
17118
|
-
|
|
17225
|
+
return this.hasCompiledPagePatch(preview);
|
|
17226
|
+
}
|
|
17227
|
+
hasCompiledPagePatch(preview) {
|
|
17228
|
+
const patch = this.toJsonObject(preview?.compiledFormPatch)?.['patch'];
|
|
17119
17229
|
const page = this.toJsonObject(patch)?.['page'];
|
|
17120
17230
|
return !!this.toJsonObject(page);
|
|
17121
17231
|
}
|
|
@@ -17130,6 +17240,17 @@ class PageBuilderAgenticAuthoringTurnFlow {
|
|
|
17130
17240
|
}
|
|
17131
17241
|
return diagnostics;
|
|
17132
17242
|
}
|
|
17243
|
+
buildLocalReviewDiagnostics(intentResolution, preview) {
|
|
17244
|
+
return {
|
|
17245
|
+
...this.buildTurnDiagnostics(intentResolution, preview),
|
|
17246
|
+
applyLineage: {
|
|
17247
|
+
schemaVersion: 'praxis-agentic-authoring-apply-lineage.v1',
|
|
17248
|
+
status: 'local-review-only',
|
|
17249
|
+
reason: 'terminal-result-required',
|
|
17250
|
+
patchAuthority: 'local-preview',
|
|
17251
|
+
},
|
|
17252
|
+
};
|
|
17253
|
+
}
|
|
17133
17254
|
buildDashboardAuthoringDiagnostics(intentResolution, preview) {
|
|
17134
17255
|
if (!this.isDashboardQualityPreview(intentResolution, preview)) {
|
|
17135
17256
|
return null;
|
|
@@ -19488,7 +19609,7 @@ class PageBuilderAgenticAuthoringTurnFlow {
|
|
|
19488
19609
|
buildContextHints(request) {
|
|
19489
19610
|
const base = this.toJsonObject(request.action?.contextHints)
|
|
19490
19611
|
?? this.toJsonObject(request.contextHints);
|
|
19491
|
-
const normalizedBase = this.normalizeAmbientDomainCatalogContextHints(base);
|
|
19612
|
+
const normalizedBase = this.normalizeAmbientDomainCatalogContextHints(this.withoutAgenticApplyTarget(base));
|
|
19492
19613
|
const scopedBase = withAuthoringScopePolicyContextHints(normalizedBase, {
|
|
19493
19614
|
componentId: this.context.targetComponentId,
|
|
19494
19615
|
componentType: 'page-builder',
|
|
@@ -19503,6 +19624,28 @@ class PageBuilderAgenticAuthoringTurnFlow {
|
|
|
19503
19624
|
includeLlmDiagnostics: true,
|
|
19504
19625
|
};
|
|
19505
19626
|
}
|
|
19627
|
+
withoutAgenticApplyTarget(contextHints) {
|
|
19628
|
+
if (!contextHints || !Object.prototype.hasOwnProperty.call(contextHints, 'agenticApplyTarget')) {
|
|
19629
|
+
return contextHints;
|
|
19630
|
+
}
|
|
19631
|
+
const sanitized = { ...contextHints };
|
|
19632
|
+
delete sanitized['agenticApplyTarget'];
|
|
19633
|
+
return sanitized;
|
|
19634
|
+
}
|
|
19635
|
+
matchesCurrentApplyTarget(target) {
|
|
19636
|
+
if (this.context.matchesApplyTarget) {
|
|
19637
|
+
return this.context.matchesApplyTarget(target);
|
|
19638
|
+
}
|
|
19639
|
+
const current = this.context.applyTarget?.();
|
|
19640
|
+
if (!current)
|
|
19641
|
+
return false;
|
|
19642
|
+
return current.schemaVersion === target.schemaVersion
|
|
19643
|
+
&& current.componentType === target.componentType
|
|
19644
|
+
&& current.componentId === target.componentId
|
|
19645
|
+
&& current.scope === target.scope
|
|
19646
|
+
&& current.mode === target.mode
|
|
19647
|
+
&& (current.baseEtag ?? null) === (target.baseEtag ?? null);
|
|
19648
|
+
}
|
|
19506
19649
|
async withSelectedComponentAuthoringContext(authoringContext, selectedWidgetKey) {
|
|
19507
19650
|
const resolver = this.context.resolveSelectedComponentAuthoringContext;
|
|
19508
19651
|
if (!selectedWidgetKey || !resolver) {
|
|
@@ -19829,7 +19972,9 @@ class DynamicPageBuilderComponent {
|
|
|
19829
19972
|
agenticAuthoringPreviewResult = signal(null, ...(ngDevMode ? [{ debugName: "agenticAuthoringPreviewResult" }] : /* istanbul ignore next */ []));
|
|
19830
19973
|
agenticAuthoringMaterializationPending = signal(false, ...(ngDevMode ? [{ debugName: "agenticAuthoringMaterializationPending" }] : /* istanbul ignore next */ []));
|
|
19831
19974
|
agenticAuthoringSemanticDecision = signal(null, ...(ngDevMode ? [{ debugName: "agenticAuthoringSemanticDecision" }] : /* istanbul ignore next */ []));
|
|
19975
|
+
agenticAuthoringSemanticResourcePresentationLabel = signal(null, ...(ngDevMode ? [{ debugName: "agenticAuthoringSemanticResourcePresentationLabel" }] : /* istanbul ignore next */ []));
|
|
19832
19976
|
agenticAuthoringTurnResultRef = signal(null, ...(ngDevMode ? [{ debugName: "agenticAuthoringTurnResultRef" }] : /* istanbul ignore next */ []));
|
|
19977
|
+
agenticAuthoringApplyTarget = signal(null, ...(ngDevMode ? [{ debugName: "agenticAuthoringApplyTarget" }] : /* istanbul ignore next */ []));
|
|
19833
19978
|
agenticAuthoringCanApply = signal(false, ...(ngDevMode ? [{ debugName: "agenticAuthoringCanApply" }] : /* istanbul ignore next */ []));
|
|
19834
19979
|
agenticAuthoringLastEtag = signal(null, ...(ngDevMode ? [{ debugName: "agenticAuthoringLastEtag" }] : /* istanbul ignore next */ []));
|
|
19835
19980
|
agenticAuthoringConversation = signal([], ...(ngDevMode ? [{ debugName: "agenticAuthoringConversation" }] : /* istanbul ignore next */ []));
|
|
@@ -19889,19 +20034,35 @@ class DynamicPageBuilderComponent {
|
|
|
19889
20034
|
}
|
|
19890
20035
|
const pageIdentityChange = changes['pageIdentity'];
|
|
19891
20036
|
const componentInstanceChange = changes['componentInstanceId'];
|
|
20037
|
+
const agenticComponentIdChange = changes['agenticAuthoringComponentId'];
|
|
20038
|
+
const agenticScopeChange = changes['agenticAuthoringScope'];
|
|
19892
20039
|
const authoringOwnerChanged = (pageIdentityChange
|
|
19893
20040
|
&& !pageIdentityChange.isFirstChange()
|
|
19894
20041
|
&& this.pageIdentityFingerprint(pageIdentityChange.previousValue)
|
|
19895
20042
|
!== this.pageIdentityFingerprint(pageIdentityChange.currentValue)) || (componentInstanceChange
|
|
19896
20043
|
&& !componentInstanceChange.isFirstChange()
|
|
19897
20044
|
&& `${componentInstanceChange.previousValue ?? ''}`.trim()
|
|
19898
|
-
!== `${componentInstanceChange.currentValue ?? ''}`.trim())
|
|
20045
|
+
!== `${componentInstanceChange.currentValue ?? ''}`.trim()) || (agenticComponentIdChange
|
|
20046
|
+
&& !agenticComponentIdChange.isFirstChange()
|
|
20047
|
+
&& `${agenticComponentIdChange.previousValue ?? ''}`.trim()
|
|
20048
|
+
!== `${agenticComponentIdChange.currentValue ?? ''}`.trim()) || (agenticScopeChange
|
|
20049
|
+
&& !agenticScopeChange.isFirstChange()
|
|
20050
|
+
&& agenticScopeChange.previousValue !== agenticScopeChange.currentValue);
|
|
19899
20051
|
if (authoringOwnerChanged) {
|
|
19900
20052
|
this.resetAgenticAuthoringSessionState(this.resolveAgenticAuthoringSessionId(pageIdentityChange?.previousValue ?? this.pageIdentity, componentInstanceChange?.previousValue ?? this.componentInstanceId));
|
|
19901
20053
|
}
|
|
19902
20054
|
else if (changes['pageLifecycleResetRevision'] && !changes['pageLifecycleResetRevision'].isFirstChange()) {
|
|
19903
20055
|
this.resetAgenticAuthoringSessionState();
|
|
19904
20056
|
}
|
|
20057
|
+
const authoringEtagChange = changes['agenticAuthoringEtag'];
|
|
20058
|
+
if (authoringEtagChange
|
|
20059
|
+
&& !authoringEtagChange.isFirstChange()
|
|
20060
|
+
&& this.normalizeAgenticEtag(`${authoringEtagChange.previousValue ?? ''}`)
|
|
20061
|
+
!== this.normalizeAgenticEtag(`${authoringEtagChange.currentValue ?? ''}`)) {
|
|
20062
|
+
this.cancelActiveAgenticTurn();
|
|
20063
|
+
this.agenticAuthoringLastEtag.set(null);
|
|
20064
|
+
this.invalidateAgenticTerminalAuthorization();
|
|
20065
|
+
}
|
|
19905
20066
|
}
|
|
19906
20067
|
ngOnDestroy() {
|
|
19907
20068
|
this.cancelActiveAgenticTurn();
|
|
@@ -20591,6 +20752,7 @@ class DynamicPageBuilderComponent {
|
|
|
20591
20752
|
|| this.agenticAuthoringBusy();
|
|
20592
20753
|
}
|
|
20593
20754
|
resetAgenticAuthoringSessionState(sessionIdToRemove = this.resolveAgenticAuthoringSessionId()) {
|
|
20755
|
+
this.cancelActiveAgenticTurn();
|
|
20594
20756
|
this.agenticTurnController = undefined;
|
|
20595
20757
|
this.sharedRuleHandoffRevision += 1;
|
|
20596
20758
|
this.agenticAuthoringBusy.set(false);
|
|
@@ -20600,8 +20762,11 @@ class DynamicPageBuilderComponent {
|
|
|
20600
20762
|
this.agenticAuthoringPreviewResult.set(null);
|
|
20601
20763
|
this.agenticAuthoringMaterializationPending.set(false);
|
|
20602
20764
|
this.agenticAuthoringSemanticDecision.set(null);
|
|
20765
|
+
this.agenticAuthoringSemanticResourcePresentationLabel.set(null);
|
|
20603
20766
|
this.agenticAuthoringTurnResultRef.set(null);
|
|
20767
|
+
this.agenticAuthoringApplyTarget.set(null);
|
|
20604
20768
|
this.agenticAuthoringCanApply.set(false);
|
|
20769
|
+
this.agenticAuthoringLastEtag.set(null);
|
|
20605
20770
|
this.agenticAuthoringConversation.set([]);
|
|
20606
20771
|
this.agenticAuthoringQuickReplies.set([]);
|
|
20607
20772
|
this.agenticAuthoringAttachments.set([]);
|
|
@@ -20970,7 +21135,9 @@ class DynamicPageBuilderComponent {
|
|
|
20970
21135
|
id: 'semantic-decision-resource',
|
|
20971
21136
|
kind: 'custom',
|
|
20972
21137
|
label: this.tx('agentic.context.semanticDecisionResource', 'Fonte'),
|
|
20973
|
-
value: this.agenticSemanticResourceLabel(selectedResource)
|
|
21138
|
+
value: this.agenticSemanticResourceLabel(selectedResource)
|
|
21139
|
+
?? this.agenticAuthoringSemanticResourcePresentationLabel()
|
|
21140
|
+
?? this.humanizeAgenticResourcePath(resourcePath),
|
|
20974
21141
|
icon: 'dataset',
|
|
20975
21142
|
});
|
|
20976
21143
|
}
|
|
@@ -21100,7 +21267,7 @@ class DynamicPageBuilderComponent {
|
|
|
21100
21267
|
this.agenticAuthoringBusy.set(true);
|
|
21101
21268
|
this.agenticAuthoringError.set('');
|
|
21102
21269
|
this.agenticAuthoringPreviewResult.set(null);
|
|
21103
|
-
this.
|
|
21270
|
+
this.invalidateAgenticTerminalAuthorization();
|
|
21104
21271
|
this.agenticAuthoringSharedRuleHandoffState.set(null);
|
|
21105
21272
|
this.clearSharedRuleCockpitState();
|
|
21106
21273
|
this.clearProjectKnowledgeCockpitState();
|
|
@@ -21143,7 +21310,7 @@ class DynamicPageBuilderComponent {
|
|
|
21143
21310
|
this.agenticAuthoringBusy.set(true);
|
|
21144
21311
|
this.agenticAuthoringError.set('');
|
|
21145
21312
|
this.agenticAuthoringPreviewResult.set(null);
|
|
21146
|
-
this.
|
|
21313
|
+
this.invalidateAgenticTerminalAuthorization();
|
|
21147
21314
|
this.agenticAuthoringSharedRuleHandoffState.set(null);
|
|
21148
21315
|
this.clearSharedRuleCockpitState();
|
|
21149
21316
|
this.clearProjectKnowledgeCockpitState();
|
|
@@ -21183,6 +21350,7 @@ class DynamicPageBuilderComponent {
|
|
|
21183
21350
|
return;
|
|
21184
21351
|
}
|
|
21185
21352
|
if (replyKind === 'revise') {
|
|
21353
|
+
this.invalidateAgenticTerminalAuthorization();
|
|
21186
21354
|
this.agenticAuthoringEditingMessageId.set(null);
|
|
21187
21355
|
this.agenticAuthoringQuickReplies.set([]);
|
|
21188
21356
|
this.agenticAuthoringStatus.set(this.tx('agentic.status.waitingRevision', 'Ajuste o pedido e crie uma nova prévia.'));
|
|
@@ -21201,7 +21369,7 @@ class DynamicPageBuilderComponent {
|
|
|
21201
21369
|
this.agenticAuthoringBusy.set(true);
|
|
21202
21370
|
this.agenticAuthoringError.set('');
|
|
21203
21371
|
this.agenticAuthoringPreviewResult.set(null);
|
|
21204
|
-
this.
|
|
21372
|
+
this.invalidateAgenticTerminalAuthorization();
|
|
21205
21373
|
this.agenticAuthoringSharedRuleHandoffState.set(null);
|
|
21206
21374
|
this.clearSharedRuleCockpitState();
|
|
21207
21375
|
this.clearProjectKnowledgeCockpitState();
|
|
@@ -21424,6 +21592,7 @@ class DynamicPageBuilderComponent {
|
|
|
21424
21592
|
editAgenticMessage(message) {
|
|
21425
21593
|
if (message.role !== 'user')
|
|
21426
21594
|
return;
|
|
21595
|
+
this.invalidateAgenticTerminalAuthorization();
|
|
21427
21596
|
this.agenticAuthoringEditingMessageId.set(message.id);
|
|
21428
21597
|
this.agenticAuthoringPrompt.set(message.text);
|
|
21429
21598
|
this.agenticAuthoringStatus.set(this.tx('agentic.status.waitingRevision', 'Ajuste o pedido e crie uma nova prévia.'));
|
|
@@ -21437,7 +21606,7 @@ class DynamicPageBuilderComponent {
|
|
|
21437
21606
|
this.agenticAuthoringStatus.set(this.tx('agentic.status.resolvingIntent', 'Entendendo o pedido...'));
|
|
21438
21607
|
this.agenticAuthoringError.set('');
|
|
21439
21608
|
this.agenticAuthoringPreviewResult.set(null);
|
|
21440
|
-
this.
|
|
21609
|
+
this.invalidateAgenticTerminalAuthorization();
|
|
21441
21610
|
this.clearProjectKnowledgeCockpitState();
|
|
21442
21611
|
try {
|
|
21443
21612
|
await this.consumeAgenticTurn(this.ensureAgenticTurnController().resendMessage(message.id), turnRunId);
|
|
@@ -21459,6 +21628,7 @@ class DynamicPageBuilderComponent {
|
|
|
21459
21628
|
async retryAgenticAuthoring() {
|
|
21460
21629
|
if (this.agenticAuthoringBusy())
|
|
21461
21630
|
return;
|
|
21631
|
+
this.invalidateAgenticTerminalAuthorization();
|
|
21462
21632
|
const turnRunId = this.beginAgenticTurn();
|
|
21463
21633
|
this.agenticAuthoringEditingMessageId.set(null);
|
|
21464
21634
|
this.agenticAuthoringBusy.set(true);
|
|
@@ -21481,6 +21651,12 @@ class DynamicPageBuilderComponent {
|
|
|
21481
21651
|
}
|
|
21482
21652
|
}
|
|
21483
21653
|
}
|
|
21654
|
+
updateAgenticAuthoringPrompt(prompt) {
|
|
21655
|
+
if (prompt !== this.agenticAuthoringPrompt()) {
|
|
21656
|
+
this.invalidateAgenticTerminalAuthorization();
|
|
21657
|
+
}
|
|
21658
|
+
this.agenticAuthoringPrompt.set(prompt);
|
|
21659
|
+
}
|
|
21484
21660
|
async cancelAgenticAuthoring() {
|
|
21485
21661
|
this.cancelActiveAgenticTurn();
|
|
21486
21662
|
this.agenticAuthoringBusy.set(false);
|
|
@@ -21489,6 +21665,7 @@ class DynamicPageBuilderComponent {
|
|
|
21489
21665
|
this.agenticAuthoringPreviewResult.set(null);
|
|
21490
21666
|
this.agenticAuthoringSemanticDecision.set(null);
|
|
21491
21667
|
this.agenticAuthoringTurnResultRef.set(null);
|
|
21668
|
+
this.agenticAuthoringApplyTarget.set(null);
|
|
21492
21669
|
this.agenticAuthoringCanApply.set(false);
|
|
21493
21670
|
this.agenticAuthoringSharedRuleHandoffState.set(null);
|
|
21494
21671
|
this.clearSharedRuleCockpitState();
|
|
@@ -21504,6 +21681,12 @@ class DynamicPageBuilderComponent {
|
|
|
21504
21681
|
this.agenticAuthoringError.set(this.tx('agentic.errors.componentId', 'Configure a component id before saving.'));
|
|
21505
21682
|
return;
|
|
21506
21683
|
}
|
|
21684
|
+
const applyTarget = this.agenticAuthoringApplyTarget();
|
|
21685
|
+
if (!applyTarget || !this.matchesCurrentAgenticApplyTarget(applyTarget)) {
|
|
21686
|
+
this.agenticAuthoringCanApply.set(false);
|
|
21687
|
+
this.agenticAuthoringError.set(this.tx('agentic.errors.applyTargetExpired', 'O destino ou a versão revisada mudou. Gere uma nova prévia antes de salvar.'));
|
|
21688
|
+
return;
|
|
21689
|
+
}
|
|
21507
21690
|
this.agenticAuthoringBusy.set(true);
|
|
21508
21691
|
this.agenticAuthoringError.set('');
|
|
21509
21692
|
this.agenticAuthoringStatus.set(this.tx('agentic.status.saving', 'Salvando tela...'));
|
|
@@ -21519,7 +21702,7 @@ class DynamicPageBuilderComponent {
|
|
|
21519
21702
|
streamId: turnResultRef.streamId,
|
|
21520
21703
|
resultEventId: turnResultRef.resultEventId,
|
|
21521
21704
|
scope: this.agenticAuthoringScope,
|
|
21522
|
-
ifMatch: this.
|
|
21705
|
+
ifMatch: this.currentAgenticAuthoringEtag() || undefined,
|
|
21523
21706
|
tags: {
|
|
21524
21707
|
source: 'page-builder-agentic-authoring',
|
|
21525
21708
|
},
|
|
@@ -21531,6 +21714,7 @@ class DynamicPageBuilderComponent {
|
|
|
21531
21714
|
this.agenticAuthoringMaterializationPending.set(false);
|
|
21532
21715
|
this.agenticAuthoringSemanticDecision.set(null);
|
|
21533
21716
|
this.agenticAuthoringTurnResultRef.set(null);
|
|
21717
|
+
this.agenticAuthoringApplyTarget.set(null);
|
|
21534
21718
|
this.agenticAuthoringCanApply.set(false);
|
|
21535
21719
|
this.agenticAuthoringQuickReplies.set([]);
|
|
21536
21720
|
this.agenticAuthoringPrompt.set('');
|
|
@@ -22394,6 +22578,22 @@ class DynamicPageBuilderComponent {
|
|
|
22394
22578
|
provider: () => this.agenticAuthoringProvider,
|
|
22395
22579
|
model: () => this.agenticAuthoringModel,
|
|
22396
22580
|
apiKey: () => this.agenticAuthoringApiKey,
|
|
22581
|
+
applyTarget: () => {
|
|
22582
|
+
const componentId = this.resolveAgenticComponentId();
|
|
22583
|
+
if (!componentId)
|
|
22584
|
+
return null;
|
|
22585
|
+
const baseEtag = this.currentAgenticAuthoringEtag();
|
|
22586
|
+
const common = {
|
|
22587
|
+
schemaVersion: 'praxis-agentic-authoring-apply-target.v1',
|
|
22588
|
+
componentType: 'praxis-dynamic-page',
|
|
22589
|
+
componentId,
|
|
22590
|
+
scope: this.agenticAuthoringScope,
|
|
22591
|
+
};
|
|
22592
|
+
return baseEtag
|
|
22593
|
+
? { ...common, mode: 'update', baseEtag: this.normalizeAgenticEtag(baseEtag) }
|
|
22594
|
+
: { ...common, mode: 'create' };
|
|
22595
|
+
},
|
|
22596
|
+
matchesApplyTarget: (target) => this.matchesCurrentAgenticApplyTarget(target),
|
|
22397
22597
|
enableTurnStream: () => this.agenticAuthoringEnableStreaming,
|
|
22398
22598
|
includeLlmDiagnostics: () => this.agenticAuthoringIncludeLlmDiagnostics,
|
|
22399
22599
|
collectRuntimeComponentObservations: () => this.collectRuntimeComponentObservationsForAgenticTurn(),
|
|
@@ -22421,9 +22621,11 @@ class DynamicPageBuilderComponent {
|
|
|
22421
22621
|
}
|
|
22422
22622
|
async applyAgenticPreviewLocally(result) {
|
|
22423
22623
|
const adapter = new PageBuilderAiAdapter(this.createAdapterHost(), this.componentMetadata);
|
|
22424
|
-
const applied = await (result.
|
|
22425
|
-
? adapter.
|
|
22426
|
-
:
|
|
22624
|
+
const applied = await (result.compiledFormPatch?.patch?.page
|
|
22625
|
+
? adapter.applyCompiledFormPatch(result.compiledFormPatch)
|
|
22626
|
+
: result.uiCompositionPlan
|
|
22627
|
+
? adapter.applyUiCompositionPlan(result.uiCompositionPlan)
|
|
22628
|
+
: adapter.applyCompiledFormPatch(result.compiledFormPatch));
|
|
22427
22629
|
if (!applied.success && this.isAgenticTableContractError(applied.error)) {
|
|
22428
22630
|
return {
|
|
22429
22631
|
...applied,
|
|
@@ -22480,9 +22682,18 @@ class DynamicPageBuilderComponent {
|
|
|
22480
22682
|
this.agenticAuthoringError.set(state.errorText);
|
|
22481
22683
|
this.agenticAuthoringPreviewResult.set(preview);
|
|
22482
22684
|
this.agenticAuthoringSemanticDecision.set(this.resolveAgenticSemanticDecision(state.diagnostics));
|
|
22685
|
+
this.agenticAuthoringSemanticResourcePresentationLabel.set(this.resolveAgenticSemanticResourcePresentationLabel(state.diagnostics));
|
|
22483
22686
|
const turnResultRef = this.resolveAgenticTurnResultRef(state.diagnostics);
|
|
22484
|
-
this.
|
|
22485
|
-
|
|
22687
|
+
const applyTarget = this.resolveAgenticApplyTarget(state.diagnostics);
|
|
22688
|
+
const canApply = (!!preview?.valid
|
|
22689
|
+
&& !!preview.compiledFormPatch?.patch?.page
|
|
22690
|
+
&& !!state.canApply
|
|
22691
|
+
&& !!turnResultRef
|
|
22692
|
+
&& !!applyTarget
|
|
22693
|
+
&& this.matchesCurrentAgenticApplyTarget(applyTarget));
|
|
22694
|
+
this.agenticAuthoringTurnResultRef.set(canApply ? turnResultRef : null);
|
|
22695
|
+
this.agenticAuthoringApplyTarget.set(canApply ? applyTarget : null);
|
|
22696
|
+
this.agenticAuthoringCanApply.set(canApply);
|
|
22486
22697
|
this.moveAgenticAuthoringPanelToReviewSidecar(preview);
|
|
22487
22698
|
this.agenticAuthoringAttachments.set(state.attachments);
|
|
22488
22699
|
if (!this.sameSharedRuleHandoffIdentity(previousHandoff, handoff)) {
|
|
@@ -22704,6 +22915,11 @@ class DynamicPageBuilderComponent {
|
|
|
22704
22915
|
this.agenticTurnRunId += 1;
|
|
22705
22916
|
this.agenticTurnCancel$.next();
|
|
22706
22917
|
}
|
|
22918
|
+
invalidateAgenticTerminalAuthorization() {
|
|
22919
|
+
this.agenticAuthoringTurnResultRef.set(null);
|
|
22920
|
+
this.agenticAuthoringApplyTarget.set(null);
|
|
22921
|
+
this.agenticAuthoringCanApply.set(false);
|
|
22922
|
+
}
|
|
22707
22923
|
isCurrentAgenticTurn(turnRunId) {
|
|
22708
22924
|
return this.agenticTurnRunId === turnRunId;
|
|
22709
22925
|
}
|
|
@@ -22783,6 +22999,12 @@ class DynamicPageBuilderComponent {
|
|
|
22783
22999
|
}
|
|
22784
23000
|
return semanticDecision;
|
|
22785
23001
|
}
|
|
23002
|
+
resolveAgenticSemanticResourcePresentationLabel(diagnostics) {
|
|
23003
|
+
const intentResolution = this.toRecord(diagnostics?.['intentResolution']);
|
|
23004
|
+
const intentContextHints = this.toRecord(intentResolution?.['contextHints']);
|
|
23005
|
+
return this.trimmedString(intentContextHints?.['resourceLabel'])
|
|
23006
|
+
?? this.trimmedString(intentContextHints?.['selectedResourceLabel']);
|
|
23007
|
+
}
|
|
22786
23008
|
resolveAgenticTurnResultRef(diagnostics) {
|
|
22787
23009
|
const candidate = this.toRecord(diagnostics?.['turnResultRef']);
|
|
22788
23010
|
const streamId = this.trimmedString(candidate?.['streamId']);
|
|
@@ -22794,6 +23016,58 @@ class DynamicPageBuilderComponent {
|
|
|
22794
23016
|
}
|
|
22795
23017
|
return { streamId, threadId, turnId, resultEventId };
|
|
22796
23018
|
}
|
|
23019
|
+
resolveAgenticApplyTarget(diagnostics) {
|
|
23020
|
+
const candidate = this.toRecord(diagnostics?.['applyTarget']);
|
|
23021
|
+
const schemaVersion = this.trimmedString(candidate?.['schemaVersion']);
|
|
23022
|
+
const componentType = this.trimmedString(candidate?.['componentType']);
|
|
23023
|
+
const componentId = this.trimmedString(candidate?.['componentId']);
|
|
23024
|
+
const scope = this.trimmedString(candidate?.['scope']);
|
|
23025
|
+
const mode = this.trimmedString(candidate?.['mode']);
|
|
23026
|
+
const baseEtag = this.trimmedString(candidate?.['baseEtag']);
|
|
23027
|
+
const environment = this.trimmedString(candidate?.['environment']);
|
|
23028
|
+
if (schemaVersion !== 'praxis-agentic-authoring-apply-target.v1'
|
|
23029
|
+
|| !componentType
|
|
23030
|
+
|| !componentId
|
|
23031
|
+
|| (scope !== 'user' && scope !== 'tenant')
|
|
23032
|
+
|| (mode !== 'create' && mode !== 'update')
|
|
23033
|
+
|| (mode === 'update' && !baseEtag)
|
|
23034
|
+
|| (mode === 'create' && !!baseEtag)) {
|
|
23035
|
+
return null;
|
|
23036
|
+
}
|
|
23037
|
+
const common = {
|
|
23038
|
+
schemaVersion,
|
|
23039
|
+
componentType,
|
|
23040
|
+
componentId,
|
|
23041
|
+
scope,
|
|
23042
|
+
...(environment ? { environment } : {}),
|
|
23043
|
+
};
|
|
23044
|
+
return mode === 'update'
|
|
23045
|
+
? { ...common, mode, baseEtag: this.normalizeAgenticEtag(baseEtag) }
|
|
23046
|
+
: { ...common, mode };
|
|
23047
|
+
}
|
|
23048
|
+
matchesCurrentAgenticApplyTarget(target) {
|
|
23049
|
+
const componentId = this.resolveAgenticComponentId();
|
|
23050
|
+
const baseEtag = this.currentAgenticAuthoringEtag();
|
|
23051
|
+
return !!componentId
|
|
23052
|
+
&& target.componentType === 'praxis-dynamic-page'
|
|
23053
|
+
&& target.componentId === componentId
|
|
23054
|
+
&& target.scope === this.agenticAuthoringScope
|
|
23055
|
+
&& target.mode === (baseEtag ? 'update' : 'create')
|
|
23056
|
+
&& (target.baseEtag ?? null) === (baseEtag ? this.normalizeAgenticEtag(baseEtag) : null);
|
|
23057
|
+
}
|
|
23058
|
+
normalizeAgenticEtag(value) {
|
|
23059
|
+
let normalized = value.trim();
|
|
23060
|
+
if (/^W\//i.test(normalized)) {
|
|
23061
|
+
normalized = normalized.slice(2).trim();
|
|
23062
|
+
}
|
|
23063
|
+
if (normalized.length >= 2 && normalized.startsWith('"') && normalized.endsWith('"')) {
|
|
23064
|
+
normalized = normalized.slice(1, -1);
|
|
23065
|
+
}
|
|
23066
|
+
return normalized.trim();
|
|
23067
|
+
}
|
|
23068
|
+
currentAgenticAuthoringEtag() {
|
|
23069
|
+
return this.agenticAuthoringLastEtag() || this.agenticAuthoringEtag || null;
|
|
23070
|
+
}
|
|
22797
23071
|
cloneAgenticContextHints(contextHints) {
|
|
22798
23072
|
if (!contextHints || typeof contextHints !== 'object' || Array.isArray(contextHints)) {
|
|
22799
23073
|
return undefined;
|
|
@@ -22852,7 +23126,10 @@ class DynamicPageBuilderComponent {
|
|
|
22852
23126
|
return value;
|
|
22853
23127
|
}
|
|
22854
23128
|
resolvePreviewCompiledFormPatch(preview) {
|
|
22855
|
-
if (preview.
|
|
23129
|
+
if (preview.compiledFormPatch?.patch?.page) {
|
|
23130
|
+
return preview.compiledFormPatch;
|
|
23131
|
+
}
|
|
23132
|
+
if (preview.uiCompositionPlan) {
|
|
22856
23133
|
const planDiagnostics = this.toRecord(this.toRecord(preview.uiCompositionPlan)?.['diagnostics']);
|
|
22857
23134
|
return {
|
|
22858
23135
|
...preview.compiledFormPatch,
|
|
@@ -23220,8 +23497,8 @@ class DynamicPageBuilderComponent {
|
|
|
23220
23497
|
[minWidth]="320"
|
|
23221
23498
|
[minHeight]="280"
|
|
23222
23499
|
[margin]="8"
|
|
23223
|
-
(promptChange)="
|
|
23224
|
-
(submitPrompt)="
|
|
23500
|
+
(promptChange)="updateAgenticAuthoringPrompt($event)"
|
|
23501
|
+
(submitPrompt)="updateAgenticAuthoringPrompt($event); previewAgenticAuthoring()"
|
|
23225
23502
|
(apply)="persistAgenticAuthoring()"
|
|
23226
23503
|
(retryTurn)="retryAgenticAuthoring()"
|
|
23227
23504
|
(cancelTurn)="cancelAgenticAuthoring()"
|
|
@@ -23720,8 +23997,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
|
|
|
23720
23997
|
[minWidth]="320"
|
|
23721
23998
|
[minHeight]="280"
|
|
23722
23999
|
[margin]="8"
|
|
23723
|
-
(promptChange)="
|
|
23724
|
-
(submitPrompt)="
|
|
24000
|
+
(promptChange)="updateAgenticAuthoringPrompt($event)"
|
|
24001
|
+
(submitPrompt)="updateAgenticAuthoringPrompt($event); previewAgenticAuthoring()"
|
|
23725
24002
|
(apply)="persistAgenticAuthoring()"
|
|
23726
24003
|
(retryTurn)="retryAgenticAuthoring()"
|
|
23727
24004
|
(cancelTurn)="cancelAgenticAuthoring()"
|
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.77",
|
|
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.77",
|
|
12
|
+
"@praxisui/core": "^9.0.0-beta.77",
|
|
13
|
+
"@praxisui/settings-panel": "^9.0.0-beta.77",
|
|
14
14
|
"rxjs": "~7.8.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
@@ -6,7 +6,7 @@ import * as rxjs from 'rxjs';
|
|
|
6
6
|
import { BehaviorSubject, Observable } from 'rxjs';
|
|
7
7
|
import { FormGroup, FormControl, FormArray } from '@angular/forms';
|
|
8
8
|
import { SettingsValueProvider } from '@praxisui/settings-panel';
|
|
9
|
-
import { AgenticAuthoringAttachmentSummaryContract, AgenticAuthoringCandidateContract, AiJsonValue, AgenticAuthoringComponentCapabilitiesResultContract, AgenticAuthoringComponentCapabilityCatalogContract, AgenticAuthoringComponentCapabilityContract, AgenticAuthoringComponentFieldAliasContract, AgenticAuthoringComponentCapabilityExampleContract, AgenticAuthoringConversationMessageContract, AgenticAuthoringIntentResolutionRequestContract, AiJsonObject, AgenticAuthoringQuickReplyContract, AgenticAuthoringPendingClarificationContract, AiContextHintsContract, AgenticAuthoringSemanticDecisionContract, AgenticAuthoringPlanRequestContract, AgenticAuthoringResourceCandidatesRequestContract, AgenticAuthoringResourceCandidatesResultContract, AgenticAuthoringTurnStreamEnvelopeContract, AgenticAuthoringTurnStreamStartResponseContract, PraxisAssistantShellMessage, PraxisAssistantShellQuickReply, PraxisAssistantShellAttachment, PraxisAssistantShellLayout, PraxisAssistantSessionSnapshot, PraxisAssistantShellLabels, PraxisAssistantRecommendedIntent, PraxisAssistantShellAction, PraxisAssistantShellState, PraxisAssistantShellContextItem } from '@praxisui/ai';
|
|
9
|
+
import { AgenticAuthoringAttachmentSummaryContract, AgenticAuthoringCandidateContract, AiJsonValue, AgenticAuthoringComponentCapabilitiesResultContract, AgenticAuthoringComponentCapabilityCatalogContract, AgenticAuthoringComponentCapabilityContract, AgenticAuthoringComponentFieldAliasContract, AgenticAuthoringComponentCapabilityExampleContract, AgenticAuthoringConversationMessageContract, AgenticAuthoringIntentResolutionRequestContract, AiJsonObject, AgenticAuthoringQuickReplyContract, AgenticAuthoringPendingClarificationContract, AiContextHintsContract, AgenticAuthoringSemanticDecisionContract, AgenticAuthoringPlanRequestContract, AgenticAuthoringResourceCandidatesRequestContract, AgenticAuthoringResourceCandidatesResultContract, AgenticAuthoringTurnStreamContextHintsContract, AgenticAuthoringTurnStreamEnvelopeContract, AgenticAuthoringTurnStreamStartResponseContract, PraxisAssistantShellMessage, PraxisAssistantShellQuickReply, PraxisAssistantShellAttachment, PraxisAssistantShellLayout, PraxisAssistantSessionSnapshot, PraxisAssistantShellLabels, PraxisAssistantRecommendedIntent, PraxisAssistantShellAction, PraxisAssistantShellState, PraxisAssistantShellContextItem } from '@praxisui/ai';
|
|
10
10
|
|
|
11
11
|
declare const PLACEHOLDER = 1;
|
|
12
12
|
|
|
@@ -1276,7 +1276,7 @@ interface PageBuilderAgenticAuthoringTurnStreamRequest {
|
|
|
1276
1276
|
pendingClarification?: PageBuilderAgenticAuthoringPendingClarification | null;
|
|
1277
1277
|
componentCapabilities?: PageBuilderAgenticAuthoringComponentCapabilitiesResult | null;
|
|
1278
1278
|
attachmentSummaries?: PageBuilderAgenticAuthoringAttachmentSummary[];
|
|
1279
|
-
contextHints?:
|
|
1279
|
+
contextHints?: AgenticAuthoringTurnStreamContextHintsContract | null;
|
|
1280
1280
|
diagnostics?: AiJsonObject | null;
|
|
1281
1281
|
runtimeComponentObservations?: readonly PraxisRuntimeComponentObservationEnvelope[];
|
|
1282
1282
|
runtimeComponentObservationTrustBoundary?: 'untrusted_frontend_observation';
|
|
@@ -1773,7 +1773,9 @@ declare class DynamicPageBuilderComponent implements OnChanges, OnDestroy {
|
|
|
1773
1773
|
readonly agenticAuthoringPreviewResult: _angular_core.WritableSignal<PageBuilderPreviewResult | null>;
|
|
1774
1774
|
private readonly agenticAuthoringMaterializationPending;
|
|
1775
1775
|
readonly agenticAuthoringSemanticDecision: _angular_core.WritableSignal<AgenticAuthoringSemanticDecisionContract | null>;
|
|
1776
|
+
private readonly agenticAuthoringSemanticResourcePresentationLabel;
|
|
1776
1777
|
private readonly agenticAuthoringTurnResultRef;
|
|
1778
|
+
private readonly agenticAuthoringApplyTarget;
|
|
1777
1779
|
readonly agenticAuthoringCanApply: _angular_core.WritableSignal<boolean>;
|
|
1778
1780
|
readonly agenticAuthoringLastEtag: _angular_core.WritableSignal<string | null>;
|
|
1779
1781
|
readonly agenticAuthoringConversation: _angular_core.WritableSignal<PraxisAssistantShellMessage[]>;
|
|
@@ -1920,6 +1922,7 @@ declare class DynamicPageBuilderComponent implements OnChanges, OnDestroy {
|
|
|
1920
1922
|
editAgenticMessage(message: PraxisAssistantShellMessage): void;
|
|
1921
1923
|
resendAgenticMessage(message: PraxisAssistantShellMessage): Promise<void>;
|
|
1922
1924
|
retryAgenticAuthoring(): Promise<void>;
|
|
1925
|
+
updateAgenticAuthoringPrompt(prompt: string): void;
|
|
1923
1926
|
cancelAgenticAuthoring(): Promise<void>;
|
|
1924
1927
|
persistAgenticAuthoring(): Promise<void>;
|
|
1925
1928
|
ensureSharedRuleDefinition(): Promise<DomainRuleDefinition | null>;
|
|
@@ -1995,6 +1998,7 @@ declare class DynamicPageBuilderComponent implements OnChanges, OnDestroy {
|
|
|
1995
1998
|
private consumeAgenticTurn;
|
|
1996
1999
|
private beginAgenticTurn;
|
|
1997
2000
|
private cancelActiveAgenticTurn;
|
|
2001
|
+
private invalidateAgenticTerminalAuthorization;
|
|
1998
2002
|
private isCurrentAgenticTurn;
|
|
1999
2003
|
private createAgenticTurnTimeoutState;
|
|
2000
2004
|
private isAgenticTurnTimeoutState;
|
|
@@ -2003,7 +2007,12 @@ declare class DynamicPageBuilderComponent implements OnChanges, OnDestroy {
|
|
|
2003
2007
|
agenticAuthoringLlmDiagnosticsText(): string;
|
|
2004
2008
|
private resolveAgenticLlmDiagnostics;
|
|
2005
2009
|
private resolveAgenticSemanticDecision;
|
|
2010
|
+
private resolveAgenticSemanticResourcePresentationLabel;
|
|
2006
2011
|
private resolveAgenticTurnResultRef;
|
|
2012
|
+
private resolveAgenticApplyTarget;
|
|
2013
|
+
private matchesCurrentAgenticApplyTarget;
|
|
2014
|
+
private normalizeAgenticEtag;
|
|
2015
|
+
private currentAgenticAuthoringEtag;
|
|
2007
2016
|
private cloneAgenticContextHints;
|
|
2008
2017
|
private resolveGovernedDomainContextSummary;
|
|
2009
2018
|
private shouldShowGovernedDomainContext;
|