@praxisui/page-builder 8.0.0-beta.12 → 8.0.0-beta.14
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/fesm2022/praxisui-page-builder.mjs +87 -34
- package/index.d.ts +4 -2
- package/package.json +4 -4
|
@@ -5081,7 +5081,7 @@ class PageBuilderAgenticAuthoringService {
|
|
|
5081
5081
|
return this.http.post(`${this.baseUrl}/resource-candidates`, request, { headers: this.buildHeaders() });
|
|
5082
5082
|
}
|
|
5083
5083
|
streamTurn(request) {
|
|
5084
|
-
return this.http.post(`${this.baseUrl}/turn/stream/start`, request, { headers: this.buildHeaders() }).pipe(switchMap((start) => this.connectTurnStream(start)));
|
|
5084
|
+
return this.http.post(`${this.baseUrl}/turn/stream/start`, request, { headers: this.buildHeaders(), withCredentials: true }).pipe(switchMap((start) => this.connectTurnStream(start)));
|
|
5085
5085
|
}
|
|
5086
5086
|
applyPage(request) {
|
|
5087
5087
|
const { ifMatch, ...body } = request;
|
|
@@ -5115,17 +5115,14 @@ class PageBuilderAgenticAuthoringService {
|
|
|
5115
5115
|
connectTurnStream(start) {
|
|
5116
5116
|
return new Observable((observer) => {
|
|
5117
5117
|
const url = this.buildStreamUrl(start);
|
|
5118
|
-
|
|
5118
|
+
const probeUrl = this.buildStreamProbeUrl(start);
|
|
5119
|
+
let source = null;
|
|
5119
5120
|
let closed = false;
|
|
5120
5121
|
let connectionErrorTimer = null;
|
|
5121
5122
|
const connectionErrorGraceMs = Math.max(0, this.options?.streamConnectionErrorGraceMs ?? 1500);
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
catch (error) {
|
|
5126
|
-
observer.error(this.streamConnectionError(error));
|
|
5127
|
-
return undefined;
|
|
5128
|
-
}
|
|
5123
|
+
let probeAbort = typeof AbortController !== 'undefined'
|
|
5124
|
+
? new AbortController()
|
|
5125
|
+
: null;
|
|
5129
5126
|
const clearConnectionErrorTimer = () => {
|
|
5130
5127
|
if (connectionErrorTimer) {
|
|
5131
5128
|
clearTimeout(connectionErrorTimer);
|
|
@@ -5138,7 +5135,7 @@ class PageBuilderAgenticAuthoringService {
|
|
|
5138
5135
|
}
|
|
5139
5136
|
closed = true;
|
|
5140
5137
|
clearConnectionErrorTimer();
|
|
5141
|
-
source
|
|
5138
|
+
source?.close();
|
|
5142
5139
|
};
|
|
5143
5140
|
const failConnection = (event) => {
|
|
5144
5141
|
if (closed) {
|
|
@@ -5162,23 +5159,58 @@ class PageBuilderAgenticAuthoringService {
|
|
|
5162
5159
|
closeSource();
|
|
5163
5160
|
}
|
|
5164
5161
|
};
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5162
|
+
void this.probeTurnStreamEndpoint(probeUrl, probeAbort)
|
|
5163
|
+
.then((status) => {
|
|
5164
|
+
probeAbort = null;
|
|
5165
|
+
if (closed) {
|
|
5166
|
+
return;
|
|
5169
5167
|
}
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5168
|
+
if (typeof status === 'number' && status >= 400) {
|
|
5169
|
+
closed = true;
|
|
5170
|
+
observer.error(this.streamConnectionError({ status }));
|
|
5171
|
+
return;
|
|
5172
|
+
}
|
|
5173
|
+
try {
|
|
5174
|
+
source = this.createEventSource(url);
|
|
5175
|
+
}
|
|
5176
|
+
catch (error) {
|
|
5177
|
+
closed = true;
|
|
5178
|
+
observer.error(this.streamConnectionError(error));
|
|
5173
5179
|
return;
|
|
5174
5180
|
}
|
|
5175
|
-
|
|
5176
|
-
|
|
5181
|
+
source.onmessage = handleMessage;
|
|
5182
|
+
if (source.addEventListener) {
|
|
5183
|
+
for (const type of AI_STREAM_EVENT_TYPES) {
|
|
5184
|
+
source.addEventListener(type, handleMessage);
|
|
5185
|
+
}
|
|
5186
|
+
}
|
|
5187
|
+
source.onerror = (event) => {
|
|
5188
|
+
if (closed || connectionErrorTimer) {
|
|
5189
|
+
return;
|
|
5190
|
+
}
|
|
5191
|
+
if (connectionErrorGraceMs === 0) {
|
|
5192
|
+
failConnection(event);
|
|
5193
|
+
return;
|
|
5194
|
+
}
|
|
5195
|
+
connectionErrorTimer = setTimeout(() => failConnection(event), connectionErrorGraceMs);
|
|
5196
|
+
};
|
|
5197
|
+
})
|
|
5198
|
+
.catch((error) => {
|
|
5199
|
+
if (closed) {
|
|
5177
5200
|
return;
|
|
5178
5201
|
}
|
|
5179
|
-
|
|
5202
|
+
closed = true;
|
|
5203
|
+
observer.error(this.streamConnectionError(error));
|
|
5204
|
+
});
|
|
5205
|
+
return () => {
|
|
5206
|
+
probeAbort?.abort();
|
|
5207
|
+
if (source) {
|
|
5208
|
+
closeSource();
|
|
5209
|
+
return;
|
|
5210
|
+
}
|
|
5211
|
+
closed = true;
|
|
5212
|
+
clearConnectionErrorTimer();
|
|
5180
5213
|
};
|
|
5181
|
-
return () => closeSource();
|
|
5182
5214
|
});
|
|
5183
5215
|
}
|
|
5184
5216
|
streamConnectionError(cause) {
|
|
@@ -5196,6 +5228,15 @@ class PageBuilderAgenticAuthoringService {
|
|
|
5196
5228
|
? url.toString()
|
|
5197
5229
|
: url.pathname + url.search;
|
|
5198
5230
|
}
|
|
5231
|
+
buildStreamProbeUrl(start) {
|
|
5232
|
+
const url = new URL(`${this.baseUrl}/turn/stream/${start.streamId}/probe`, typeof window !== 'undefined' ? window.location.origin : 'http://localhost');
|
|
5233
|
+
if (start.streamAccessToken) {
|
|
5234
|
+
url.searchParams.set('accessToken', start.streamAccessToken);
|
|
5235
|
+
}
|
|
5236
|
+
return /^https?:\/\//i.test(this.baseUrl)
|
|
5237
|
+
? url.toString()
|
|
5238
|
+
: url.pathname + url.search;
|
|
5239
|
+
}
|
|
5199
5240
|
createEventSource(url) {
|
|
5200
5241
|
const factory = this.options?.eventSourceFactory;
|
|
5201
5242
|
if (factory) {
|
|
@@ -5203,6 +5244,18 @@ class PageBuilderAgenticAuthoringService {
|
|
|
5203
5244
|
}
|
|
5204
5245
|
return new EventSource(url);
|
|
5205
5246
|
}
|
|
5247
|
+
async probeTurnStreamEndpoint(url, abort) {
|
|
5248
|
+
if (typeof fetch === 'undefined') {
|
|
5249
|
+
return null;
|
|
5250
|
+
}
|
|
5251
|
+
const response = await fetch(url, {
|
|
5252
|
+
method: 'GET',
|
|
5253
|
+
credentials: 'include',
|
|
5254
|
+
cache: 'no-store',
|
|
5255
|
+
signal: abort?.signal,
|
|
5256
|
+
});
|
|
5257
|
+
return response.status;
|
|
5258
|
+
}
|
|
5206
5259
|
formatEtag(etag) {
|
|
5207
5260
|
const trimmed = etag.trim();
|
|
5208
5261
|
return trimmed.startsWith('"') ? trimmed : `"${trimmed}"`;
|
|
@@ -5310,7 +5363,7 @@ const PRAXIS_PAGE_BUILDER_AUTHORING_MANIFEST = {
|
|
|
5310
5363
|
} }],
|
|
5311
5364
|
validators: ['widget-page-definition-valid', 'no-legacy-grid-page-definition', 'page-context-json-valid', 'settings-panel-round-trip-valid'],
|
|
5312
5365
|
affectedPaths: ['title', 'layoutPreset', 'context', 'metadata'],
|
|
5313
|
-
submissionImpact:
|
|
5366
|
+
submissionImpact: 'config-only',
|
|
5314
5367
|
preconditions: ['page-loaded'],
|
|
5315
5368
|
},
|
|
5316
5369
|
{
|
|
@@ -5330,7 +5383,7 @@ const PRAXIS_PAGE_BUILDER_AUTHORING_MANIFEST = {
|
|
|
5330
5383
|
} }],
|
|
5331
5384
|
validators: ['canvas-columns-integer', 'canvas-row-unit-valid', 'canvas-gap-valid', 'canvas-items-reference-existing-widgets'],
|
|
5332
5385
|
affectedPaths: ['canvas.columns', 'canvas.rowUnit', 'canvas.gap', 'canvas.items'],
|
|
5333
|
-
submissionImpact:
|
|
5386
|
+
submissionImpact: 'config-only',
|
|
5334
5387
|
preconditions: ['page-loaded'],
|
|
5335
5388
|
},
|
|
5336
5389
|
{
|
|
@@ -5350,7 +5403,7 @@ const PRAXIS_PAGE_BUILDER_AUTHORING_MANIFEST = {
|
|
|
5350
5403
|
} }],
|
|
5351
5404
|
validators: ['widget-key-unique', 'component-registered', 'canvas-item-valid', 'child-inputs-delegated', 'widget-key-not-array-index'],
|
|
5352
5405
|
affectedPaths: ['widgets[]', 'canvas.items[]'],
|
|
5353
|
-
submissionImpact:
|
|
5406
|
+
submissionImpact: 'config-only',
|
|
5354
5407
|
preconditions: ['page-loaded', 'component-catalog-loaded'],
|
|
5355
5408
|
},
|
|
5356
5409
|
{
|
|
@@ -5371,7 +5424,7 @@ const PRAXIS_PAGE_BUILDER_AUTHORING_MANIFEST = {
|
|
|
5371
5424
|
requiresConfirmation: true,
|
|
5372
5425
|
validators: ['widget-exists', 'destructive-removal-confirmed', 'composition-links-cleaned', 'canvas-items-reference-existing-widgets'],
|
|
5373
5426
|
affectedPaths: ['widgets[]', 'canvas.items[]', 'composition.links[]'],
|
|
5374
|
-
submissionImpact:
|
|
5427
|
+
submissionImpact: 'config-only',
|
|
5375
5428
|
preconditions: ['page-loaded', 'target-widget-exists'],
|
|
5376
5429
|
},
|
|
5377
5430
|
{
|
|
@@ -5390,7 +5443,7 @@ const PRAXIS_PAGE_BUILDER_AUTHORING_MANIFEST = {
|
|
|
5390
5443
|
} }],
|
|
5391
5444
|
validators: ['widget-exists', 'canvas-item-valid', 'canvas-item-targets-existing-widget', 'canvas-overlap-policy-valid'],
|
|
5392
5445
|
affectedPaths: ['canvas.items[]'],
|
|
5393
|
-
submissionImpact:
|
|
5446
|
+
submissionImpact: 'config-only',
|
|
5394
5447
|
preconditions: ['page-loaded', 'target-widget-exists'],
|
|
5395
5448
|
},
|
|
5396
5449
|
{
|
|
@@ -5409,7 +5462,7 @@ const PRAXIS_PAGE_BUILDER_AUTHORING_MANIFEST = {
|
|
|
5409
5462
|
} }],
|
|
5410
5463
|
validators: ['widget-exists', 'widget-shell-shape-valid', 'settings-panel-bridge-available', 'child-inputs-not-mutated'],
|
|
5411
5464
|
affectedPaths: ['widgets[].shell'],
|
|
5412
|
-
submissionImpact:
|
|
5465
|
+
submissionImpact: 'config-only',
|
|
5413
5466
|
preconditions: ['page-loaded', 'target-widget-exists'],
|
|
5414
5467
|
},
|
|
5415
5468
|
{
|
|
@@ -5429,7 +5482,7 @@ const PRAXIS_PAGE_BUILDER_AUTHORING_MANIFEST = {
|
|
|
5429
5482
|
} }],
|
|
5430
5483
|
validators: ['composition-link-id-unique', 'composition-endpoints-resolve', 'nested-path-terminal-widget-key-required', 'json-logic-condition-valid', 'no-legacy-connections-write'],
|
|
5431
5484
|
affectedPaths: ['composition.links[]'],
|
|
5432
|
-
submissionImpact:
|
|
5485
|
+
submissionImpact: 'config-only',
|
|
5433
5486
|
preconditions: ['page-loaded', 'widgets-resolvable'],
|
|
5434
5487
|
},
|
|
5435
5488
|
{
|
|
@@ -5450,7 +5503,7 @@ const PRAXIS_PAGE_BUILDER_AUTHORING_MANIFEST = {
|
|
|
5450
5503
|
requiresConfirmation: true,
|
|
5451
5504
|
validators: ['composition-link-exists', 'destructive-removal-confirmed', 'composition-links-still-valid'],
|
|
5452
5505
|
affectedPaths: ['composition.links[]'],
|
|
5453
|
-
submissionImpact:
|
|
5506
|
+
submissionImpact: 'config-only',
|
|
5454
5507
|
preconditions: ['page-loaded', 'target-link-exists'],
|
|
5455
5508
|
},
|
|
5456
5509
|
{
|
|
@@ -5469,7 +5522,7 @@ const PRAXIS_PAGE_BUILDER_AUTHORING_MANIFEST = {
|
|
|
5469
5522
|
} }],
|
|
5470
5523
|
validators: ['ui-composition-plan-valid', 'compiled-page-valid', 'widget-keys-unique', 'composition-endpoints-resolve', 'canvas-items-reference-existing-widgets'],
|
|
5471
5524
|
affectedPaths: ['uiCompositionPlan', 'compiledFormPatch.patch.page'],
|
|
5472
|
-
submissionImpact:
|
|
5525
|
+
submissionImpact: 'none',
|
|
5473
5526
|
preconditions: ['agentic-preview-loaded', 'component-catalog-loaded'],
|
|
5474
5527
|
},
|
|
5475
5528
|
{
|
|
@@ -5488,7 +5541,7 @@ const PRAXIS_PAGE_BUILDER_AUTHORING_MANIFEST = {
|
|
|
5488
5541
|
} }],
|
|
5489
5542
|
validators: ['state-path-valid', 'state-layer-valid', 'state-json-valid', 'composition-state-links-still-valid'],
|
|
5490
5543
|
affectedPaths: ['state'],
|
|
5491
|
-
submissionImpact:
|
|
5544
|
+
submissionImpact: 'config-only',
|
|
5492
5545
|
preconditions: ['page-loaded'],
|
|
5493
5546
|
},
|
|
5494
5547
|
{
|
|
@@ -5507,7 +5560,7 @@ const PRAXIS_PAGE_BUILDER_AUTHORING_MANIFEST = {
|
|
|
5507
5560
|
} }],
|
|
5508
5561
|
validators: ['preview-result-valid', 'compiled-page-patch-present', 'no-envelope-runtime-persistence', 'runtime-page-valid'],
|
|
5509
5562
|
affectedPaths: ['compiledFormPatch.patch.page', 'page'],
|
|
5510
|
-
submissionImpact:
|
|
5563
|
+
submissionImpact: 'visual-only',
|
|
5511
5564
|
preconditions: ['agentic-preview-loaded'],
|
|
5512
5565
|
},
|
|
5513
5566
|
{
|
|
@@ -5526,7 +5579,7 @@ const PRAXIS_PAGE_BUILDER_AUTHORING_MANIFEST = {
|
|
|
5526
5579
|
} }],
|
|
5527
5580
|
validators: ['page-identity-complete', 'etag-policy-valid', 'runtime-page-valid', 'no-envelope-runtime-persistence'],
|
|
5528
5581
|
affectedPaths: ['page', 'pageIdentity', 'etag'],
|
|
5529
|
-
submissionImpact:
|
|
5582
|
+
submissionImpact: 'config-only',
|
|
5530
5583
|
preconditions: ['page-loaded', 'page-identity-known'],
|
|
5531
5584
|
},
|
|
5532
5585
|
{
|
|
@@ -5546,7 +5599,7 @@ const PRAXIS_PAGE_BUILDER_AUTHORING_MANIFEST = {
|
|
|
5546
5599
|
} }],
|
|
5547
5600
|
validators: ['widget-exists', 'child-manifest-available', 'child-operation-known', 'component-config-editor-respected', 'no-local-child-input-write'],
|
|
5548
5601
|
affectedPaths: ['widgets[].definition.inputs'],
|
|
5549
|
-
submissionImpact:
|
|
5602
|
+
submissionImpact: 'config-only',
|
|
5550
5603
|
preconditions: ['page-loaded', 'target-widget-exists', 'child-authoring-contract-available'],
|
|
5551
5604
|
},
|
|
5552
5605
|
],
|
package/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import * as rxjs from 'rxjs';
|
|
|
7
7
|
import { BehaviorSubject, Observable } from 'rxjs';
|
|
8
8
|
import { FormGroup, FormControl, FormArray } from '@angular/forms';
|
|
9
9
|
import { SettingsValueProvider } from '@praxisui/settings-panel';
|
|
10
|
-
import { AgenticAuthoringPlanRequestContract, AgenticAuthoringCandidateContract, AiJsonValue, AgenticAuthoringQuickReplyContract, AgenticAuthoringPendingClarificationContract, AiJsonObject, AgenticAuthoringComponentCapabilitiesResultContract, AgenticAuthoringComponentCapabilityCatalogContract, AgenticAuthoringComponentCapabilityContract, AgenticAuthoringComponentFieldAliasContract, AgenticAuthoringComponentCapabilityExampleContract, AgenticAuthoringAttachmentSummaryContract, AgenticAuthoringIntentResolutionRequestContract, AgenticAuthoringConversationMessageContract, AgenticAuthoringResourceCandidatesRequestContract, AgenticAuthoringResourceCandidatesResultContract, AgenticAuthoringTurnStreamStartResponseContract, AgenticAuthoringTurnStreamEnvelopeContract, PraxisAssistantShellMessage, PraxisAssistantShellQuickReply, PraxisAssistantShellAttachment, PraxisAssistantShellLayout, PraxisAssistantShellLabels, PraxisAssistantShellState, PraxisAssistantShellContextItem } from '@praxisui/ai';
|
|
10
|
+
import { AgenticAuthoringPlanRequestContract, AgenticAuthoringCandidateContract, AiJsonValue, AgenticAuthoringQuickReplyContract, AgenticAuthoringPendingClarificationContract, AiJsonObject, AgenticAuthoringComponentCapabilitiesResultContract, AgenticAuthoringComponentCapabilityCatalogContract, AgenticAuthoringComponentCapabilityContract, AgenticAuthoringComponentFieldAliasContract, AgenticAuthoringComponentCapabilityExampleContract, AgenticAuthoringAttachmentSummaryContract, AgenticAuthoringIntentResolutionRequestContract, AgenticAuthoringConversationMessageContract, AiContextHintsContract, AgenticAuthoringResourceCandidatesRequestContract, AgenticAuthoringResourceCandidatesResultContract, AgenticAuthoringTurnStreamStartResponseContract, AgenticAuthoringTurnStreamEnvelopeContract, PraxisAssistantShellMessage, PraxisAssistantShellQuickReply, PraxisAssistantShellAttachment, PraxisAssistantShellLayout, PraxisAssistantShellLabels, PraxisAssistantShellState, PraxisAssistantShellContextItem } from '@praxisui/ai';
|
|
11
11
|
|
|
12
12
|
declare const PLACEHOLDER = 1;
|
|
13
13
|
|
|
@@ -589,7 +589,7 @@ interface PageBuilderAgenticAuthoringTurnStreamRequest {
|
|
|
589
589
|
pendingClarification?: PageBuilderAgenticAuthoringPendingClarification | null;
|
|
590
590
|
componentCapabilities?: PageBuilderAgenticAuthoringComponentCapabilitiesResult | null;
|
|
591
591
|
attachmentSummaries?: PageBuilderAgenticAuthoringAttachmentSummary[];
|
|
592
|
-
contextHints?:
|
|
592
|
+
contextHints?: AiContextHintsContract | null;
|
|
593
593
|
}
|
|
594
594
|
type PageBuilderAgenticAuthoringConversationMessage = AgenticAuthoringConversationMessageContract;
|
|
595
595
|
type PageBuilderAgenticAuthoringPendingClarification = AgenticAuthoringPendingClarificationContract;
|
|
@@ -748,7 +748,9 @@ declare class PageBuilderAgenticAuthoringService {
|
|
|
748
748
|
private connectTurnStream;
|
|
749
749
|
private streamConnectionError;
|
|
750
750
|
private buildStreamUrl;
|
|
751
|
+
private buildStreamProbeUrl;
|
|
751
752
|
private createEventSource;
|
|
753
|
+
private probeTurnStreamEndpoint;
|
|
752
754
|
private formatEtag;
|
|
753
755
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<PageBuilderAgenticAuthoringService, never>;
|
|
754
756
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<PageBuilderAgenticAuthoringService>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@praxisui/page-builder",
|
|
3
|
-
"version": "8.0.0-beta.
|
|
3
|
+
"version": "8.0.0-beta.14",
|
|
4
4
|
"description": "Page and widget builder utilities for Praxis UI (grid, dynamic widgets, editors).",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@angular/common": "^20.0.0",
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"@angular/forms": "^20.0.0",
|
|
9
9
|
"@angular/cdk": "^20.0.0",
|
|
10
10
|
"@angular/material": "^20.0.0",
|
|
11
|
-
"@praxisui/ai": "^8.0.0-beta.
|
|
12
|
-
"@praxisui/core": "^8.0.0-beta.
|
|
13
|
-
"@praxisui/settings-panel": "^8.0.0-beta.
|
|
11
|
+
"@praxisui/ai": "^8.0.0-beta.14",
|
|
12
|
+
"@praxisui/core": "^8.0.0-beta.14",
|
|
13
|
+
"@praxisui/settings-panel": "^8.0.0-beta.14"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"tslib": "^2.3.0"
|