@praxisui/page-builder 8.0.0-beta.100 → 8.0.0-beta.102
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.
|
@@ -25,13 +25,13 @@ import * as i6 from '@angular/material/divider';
|
|
|
25
25
|
import { MatDividerModule } from '@angular/material/divider';
|
|
26
26
|
import * as i6$1 from '@angular/material/select';
|
|
27
27
|
import { MatSelectModule } from '@angular/material/select';
|
|
28
|
-
import { BehaviorSubject, merge, timeout, map,
|
|
28
|
+
import { BehaviorSubject, merge, timeout, map, catchError, throwError, from, firstValueFrom, share, concatMap, of, timer, takeUntil, filter, take } from 'rxjs';
|
|
29
29
|
import { SETTINGS_PANEL_DATA } from '@praxisui/settings-panel';
|
|
30
30
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
31
31
|
import * as i7 from '@angular/material/tabs';
|
|
32
32
|
import { MatTabsModule } from '@angular/material/tabs';
|
|
33
33
|
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
34
|
-
import {
|
|
34
|
+
import { AgenticAuthoringTurnClientService, toPraxisAssistantConversationMessages, PraxisAssistantTurnOrchestratorService, PraxisAssistantSessionRegistryService, createPraxisAssistantViewportLayout, PraxisAiAssistantShellComponent } from '@praxisui/ai';
|
|
35
35
|
|
|
36
36
|
const PLACEHOLDER = 1;
|
|
37
37
|
|
|
@@ -12060,6 +12060,7 @@ const DEFAULT_TURN_STREAM_SILENCE_STATUS_MS = 20000;
|
|
|
12060
12060
|
const PAGE_BUILDER_AGENTIC_AUTHORING_OPTIONS = new InjectionToken('PAGE_BUILDER_AGENTIC_AUTHORING_OPTIONS');
|
|
12061
12061
|
class PageBuilderAgenticAuthoringService {
|
|
12062
12062
|
http = inject(HttpClient);
|
|
12063
|
+
turnClient = inject(AgenticAuthoringTurnClientService);
|
|
12063
12064
|
options = inject(PAGE_BUILDER_AGENTIC_AUTHORING_OPTIONS, {
|
|
12064
12065
|
optional: true,
|
|
12065
12066
|
});
|
|
@@ -12078,15 +12079,14 @@ class PageBuilderAgenticAuthoringService {
|
|
|
12078
12079
|
return this.http.post(`${this.baseUrl}/resource-candidates`, request, { headers: this.buildHeaders() }).pipe(timeout({ first: this.requestTimeoutMs() }));
|
|
12079
12080
|
}
|
|
12080
12081
|
streamTurn(request) {
|
|
12081
|
-
|
|
12082
|
-
|
|
12083
|
-
|
|
12084
|
-
|
|
12085
|
-
|
|
12086
|
-
|
|
12087
|
-
|
|
12088
|
-
|
|
12089
|
-
})), this.connectTurnStream(start, { startRequestElapsedMs }))));
|
|
12082
|
+
const startRequestedAt = Date.now();
|
|
12083
|
+
return this.turnClient.streamEvents(request, {
|
|
12084
|
+
baseUrl: this.baseUrl,
|
|
12085
|
+
headers: this.buildHeaderRecord(),
|
|
12086
|
+
silenceStatusMs: this.streamSilenceStatusMs(),
|
|
12087
|
+
resultTimeoutMs: this.streamResultFallbackMs(),
|
|
12088
|
+
streamTimeoutMs: this.streamTurnTimeoutMs(),
|
|
12089
|
+
}).pipe(timeout({ first: this.streamStartTimeoutMs() }), map((event) => this.toTurnStreamEvent(event, startRequestedAt)), catchError((error) => throwError(() => this.toTurnStreamError(error))));
|
|
12090
12090
|
}
|
|
12091
12091
|
applyPage(request) {
|
|
12092
12092
|
const { ifMatch, ...body } = request;
|
|
@@ -12101,7 +12101,7 @@ class PageBuilderAgenticAuthoringService {
|
|
|
12101
12101
|
headers: this.buildHeaders(ifMatch ? { 'If-Match': this.formatEtag(ifMatch) } : undefined),
|
|
12102
12102
|
});
|
|
12103
12103
|
}
|
|
12104
|
-
|
|
12104
|
+
buildHeaderRecord(extra) {
|
|
12105
12105
|
const merged = {
|
|
12106
12106
|
...(this.options?.defaultHeaders ?? {}),
|
|
12107
12107
|
};
|
|
@@ -12116,271 +12116,50 @@ class PageBuilderAgenticAuthoringService {
|
|
|
12116
12116
|
merged[key] = value;
|
|
12117
12117
|
}
|
|
12118
12118
|
}
|
|
12119
|
-
return
|
|
12120
|
-
}
|
|
12121
|
-
connectTurnStream(start, telemetry) {
|
|
12122
|
-
return new Observable((observer) => {
|
|
12123
|
-
const connectStartedAt = Date.now();
|
|
12124
|
-
const url = this.buildStreamUrl(start);
|
|
12125
|
-
const probeUrl = this.buildStreamProbeUrl(start);
|
|
12126
|
-
let source = null;
|
|
12127
|
-
let closed = false;
|
|
12128
|
-
let firstEventReceived = false;
|
|
12129
|
-
let streamTimeout = null;
|
|
12130
|
-
let resultFallbackTimeout = null;
|
|
12131
|
-
let silenceStatusTimeout = null;
|
|
12132
|
-
const streamTimeoutMs = this.streamTurnTimeoutMs();
|
|
12133
|
-
const resultFallbackMs = this.streamResultFallbackMs();
|
|
12134
|
-
const silenceStatusMs = this.streamSilenceStatusMs();
|
|
12135
|
-
let probeAbort = typeof AbortController !== 'undefined'
|
|
12136
|
-
? new AbortController()
|
|
12137
|
-
: null;
|
|
12138
|
-
let streamAbort = null;
|
|
12139
|
-
const clearStreamTimeout = () => {
|
|
12140
|
-
if (streamTimeout) {
|
|
12141
|
-
clearTimeout(streamTimeout);
|
|
12142
|
-
streamTimeout = null;
|
|
12143
|
-
}
|
|
12144
|
-
};
|
|
12145
|
-
const clearResultFallbackTimeout = () => {
|
|
12146
|
-
if (resultFallbackTimeout) {
|
|
12147
|
-
clearTimeout(resultFallbackTimeout);
|
|
12148
|
-
resultFallbackTimeout = null;
|
|
12149
|
-
}
|
|
12150
|
-
};
|
|
12151
|
-
const clearSilenceStatusTimeout = () => {
|
|
12152
|
-
if (silenceStatusTimeout) {
|
|
12153
|
-
clearTimeout(silenceStatusTimeout);
|
|
12154
|
-
silenceStatusTimeout = null;
|
|
12155
|
-
}
|
|
12156
|
-
};
|
|
12157
|
-
const closeSource = () => {
|
|
12158
|
-
if (closed) {
|
|
12159
|
-
return;
|
|
12160
|
-
}
|
|
12161
|
-
closed = true;
|
|
12162
|
-
clearStreamTimeout();
|
|
12163
|
-
clearResultFallbackTimeout();
|
|
12164
|
-
clearSilenceStatusTimeout();
|
|
12165
|
-
streamAbort?.abort();
|
|
12166
|
-
streamAbort = null;
|
|
12167
|
-
source?.close();
|
|
12168
|
-
};
|
|
12169
|
-
const startSilenceStatusTimer = () => {
|
|
12170
|
-
clearSilenceStatusTimeout();
|
|
12171
|
-
if (silenceStatusMs <= 0)
|
|
12172
|
-
return;
|
|
12173
|
-
silenceStatusTimeout = setTimeout(() => {
|
|
12174
|
-
if (closed)
|
|
12175
|
-
return;
|
|
12176
|
-
observer.next(this.streamSilenceStatusEvent(start, silenceStatusMs, resultFallbackMs));
|
|
12177
|
-
}, silenceStatusMs);
|
|
12178
|
-
};
|
|
12179
|
-
const startResultFallbackTimer = () => {
|
|
12180
|
-
clearResultFallbackTimeout();
|
|
12181
|
-
if (resultFallbackMs <= 0)
|
|
12182
|
-
return;
|
|
12183
|
-
resultFallbackTimeout = setTimeout(() => {
|
|
12184
|
-
if (closed)
|
|
12185
|
-
return;
|
|
12186
|
-
streamAbort?.abort();
|
|
12187
|
-
streamAbort = null;
|
|
12188
|
-
source?.close();
|
|
12189
|
-
observer.error(this.streamConnectionError({
|
|
12190
|
-
code: 'agentic-authoring-result-fallback',
|
|
12191
|
-
message: `Agentic authoring stream did not deliver a result after ${resultFallbackMs}ms.`,
|
|
12192
|
-
fallbackAuthoringUrl: start.fallbackAuthoringUrl ?? null,
|
|
12193
|
-
}));
|
|
12194
|
-
closeSource();
|
|
12195
|
-
}, resultFallbackMs);
|
|
12196
|
-
};
|
|
12197
|
-
streamTimeout = setTimeout(() => {
|
|
12198
|
-
if (closed) {
|
|
12199
|
-
return;
|
|
12200
|
-
}
|
|
12201
|
-
observer.error({
|
|
12202
|
-
name: 'TimeoutError',
|
|
12203
|
-
code: 'agentic-authoring-timeout',
|
|
12204
|
-
message: `Agentic authoring turn timed out after ${streamTimeoutMs}ms.`,
|
|
12205
|
-
});
|
|
12206
|
-
closeSource();
|
|
12207
|
-
}, streamTimeoutMs);
|
|
12208
|
-
const handleMessage = (event) => {
|
|
12209
|
-
let parsed;
|
|
12210
|
-
try {
|
|
12211
|
-
parsed = JSON.parse(event.data);
|
|
12212
|
-
}
|
|
12213
|
-
catch (error) {
|
|
12214
|
-
observer.error(this.streamConnectionError(error));
|
|
12215
|
-
closeSource();
|
|
12216
|
-
return;
|
|
12217
|
-
}
|
|
12218
|
-
if (!firstEventReceived) {
|
|
12219
|
-
firstEventReceived = true;
|
|
12220
|
-
observer.next(this.streamLifecycleStatusEvent(start, 'stream.first-event.received', {
|
|
12221
|
-
startRequestElapsedMs: telemetry.startRequestElapsedMs,
|
|
12222
|
-
connectElapsedMs: Math.max(0, Date.now() - connectStartedAt),
|
|
12223
|
-
firstEventSeq: parsed.seq ?? null,
|
|
12224
|
-
firstEventType: parsed.type ?? null,
|
|
12225
|
-
}));
|
|
12226
|
-
}
|
|
12227
|
-
clearSilenceStatusTimeout();
|
|
12228
|
-
observer.next(parsed);
|
|
12229
|
-
if (parsed.type === 'result' || parsed.type === 'error' || parsed.type === 'cancelled') {
|
|
12230
|
-
clearResultFallbackTimeout();
|
|
12231
|
-
observer.complete();
|
|
12232
|
-
closeSource();
|
|
12233
|
-
}
|
|
12234
|
-
};
|
|
12235
|
-
void this.probeTurnStreamEndpoint(probeUrl, probeAbort)
|
|
12236
|
-
.then((status) => {
|
|
12237
|
-
probeAbort = null;
|
|
12238
|
-
if (closed) {
|
|
12239
|
-
return;
|
|
12240
|
-
}
|
|
12241
|
-
if (typeof status === 'number' && status >= 400) {
|
|
12242
|
-
closed = true;
|
|
12243
|
-
observer.error(this.streamConnectionError({ status }));
|
|
12244
|
-
return;
|
|
12245
|
-
}
|
|
12246
|
-
observer.next(this.streamLifecycleStatusEvent(start, 'stream.probe.ready', {
|
|
12247
|
-
startRequestElapsedMs: telemetry.startRequestElapsedMs,
|
|
12248
|
-
connectElapsedMs: Math.max(0, Date.now() - connectStartedAt),
|
|
12249
|
-
probeStatus: status,
|
|
12250
|
-
}));
|
|
12251
|
-
if (!this.options?.eventSourceFactory && typeof fetch === 'function' && typeof TextDecoder !== 'undefined') {
|
|
12252
|
-
streamAbort = typeof AbortController !== 'undefined' ? new AbortController() : null;
|
|
12253
|
-
observer.next(this.streamLifecycleStatusEvent(start, 'stream.transport.opening', {
|
|
12254
|
-
startRequestElapsedMs: telemetry.startRequestElapsedMs,
|
|
12255
|
-
connectElapsedMs: Math.max(0, Date.now() - connectStartedAt),
|
|
12256
|
-
transport: 'fetch',
|
|
12257
|
-
}));
|
|
12258
|
-
startResultFallbackTimer();
|
|
12259
|
-
startSilenceStatusTimer();
|
|
12260
|
-
void this.consumeFetchTurnStream(url, streamAbort, handleMessage, () => closed).catch((error) => {
|
|
12261
|
-
if (closed) {
|
|
12262
|
-
return;
|
|
12263
|
-
}
|
|
12264
|
-
observer.error(this.streamConnectionError(error));
|
|
12265
|
-
closeSource();
|
|
12266
|
-
});
|
|
12267
|
-
return;
|
|
12268
|
-
}
|
|
12269
|
-
try {
|
|
12270
|
-
source = this.createEventSource(url);
|
|
12271
|
-
}
|
|
12272
|
-
catch (error) {
|
|
12273
|
-
closed = true;
|
|
12274
|
-
observer.error(this.streamConnectionError(error));
|
|
12275
|
-
return;
|
|
12276
|
-
}
|
|
12277
|
-
observer.next(this.streamLifecycleStatusEvent(start, 'stream.transport.opening', {
|
|
12278
|
-
startRequestElapsedMs: telemetry.startRequestElapsedMs,
|
|
12279
|
-
connectElapsedMs: Math.max(0, Date.now() - connectStartedAt),
|
|
12280
|
-
transport: 'event-source',
|
|
12281
|
-
}));
|
|
12282
|
-
startResultFallbackTimer();
|
|
12283
|
-
startSilenceStatusTimer();
|
|
12284
|
-
source.onmessage = handleMessage;
|
|
12285
|
-
if (source.addEventListener) {
|
|
12286
|
-
for (const type of AI_STREAM_EVENT_TYPES) {
|
|
12287
|
-
source.addEventListener(type, handleMessage);
|
|
12288
|
-
}
|
|
12289
|
-
}
|
|
12290
|
-
source.onerror = (event) => {
|
|
12291
|
-
if (closed) {
|
|
12292
|
-
return;
|
|
12293
|
-
}
|
|
12294
|
-
if (source?.readyState === EventSource.CLOSED) {
|
|
12295
|
-
observer.error(this.streamConnectionError(event));
|
|
12296
|
-
closeSource();
|
|
12297
|
-
}
|
|
12298
|
-
};
|
|
12299
|
-
})
|
|
12300
|
-
.catch((error) => {
|
|
12301
|
-
if (closed) {
|
|
12302
|
-
return;
|
|
12303
|
-
}
|
|
12304
|
-
closed = true;
|
|
12305
|
-
clearStreamTimeout();
|
|
12306
|
-
observer.error(this.streamConnectionError(error));
|
|
12307
|
-
});
|
|
12308
|
-
return () => {
|
|
12309
|
-
probeAbort?.abort();
|
|
12310
|
-
if (source) {
|
|
12311
|
-
closeSource();
|
|
12312
|
-
return;
|
|
12313
|
-
}
|
|
12314
|
-
closed = true;
|
|
12315
|
-
streamAbort?.abort();
|
|
12316
|
-
streamAbort = null;
|
|
12317
|
-
clearStreamTimeout();
|
|
12318
|
-
clearResultFallbackTimeout();
|
|
12319
|
-
clearSilenceStatusTimeout();
|
|
12320
|
-
};
|
|
12321
|
-
});
|
|
12119
|
+
return merged;
|
|
12322
12120
|
}
|
|
12323
|
-
|
|
12324
|
-
|
|
12325
|
-
|
|
12326
|
-
|
|
12327
|
-
|
|
12328
|
-
|
|
12329
|
-
|
|
12330
|
-
|
|
12331
|
-
if (!response.ok) {
|
|
12332
|
-
throw { status: response.status };
|
|
12121
|
+
buildHeaders(extra) {
|
|
12122
|
+
return new HttpHeaders(this.buildHeaderRecord(extra));
|
|
12123
|
+
}
|
|
12124
|
+
toTurnStreamEvent(event, startRequestedAt) {
|
|
12125
|
+
if (event.kind === 'stream-started') {
|
|
12126
|
+
return this.streamLifecycleStatusEvent(event.start, 'stream.start.accepted', {
|
|
12127
|
+
startRequestElapsedMs: Math.max(0, Date.now() - startRequestedAt),
|
|
12128
|
+
});
|
|
12333
12129
|
}
|
|
12334
|
-
if (
|
|
12335
|
-
|
|
12130
|
+
if (event.kind === 'stream-lifecycle') {
|
|
12131
|
+
return this.streamLifecycleStatusEvent(event.start, event.phase, {
|
|
12132
|
+
startRequestElapsedMs: Math.max(0, Date.now() - startRequestedAt),
|
|
12133
|
+
...(event.diagnostics ?? {}),
|
|
12134
|
+
});
|
|
12336
12135
|
}
|
|
12337
|
-
|
|
12338
|
-
|
|
12339
|
-
|
|
12340
|
-
|
|
12341
|
-
|
|
12342
|
-
|
|
12343
|
-
|
|
12344
|
-
|
|
12345
|
-
|
|
12346
|
-
|
|
12347
|
-
|
|
12348
|
-
|
|
12349
|
-
|
|
12350
|
-
|
|
12136
|
+
return event.event;
|
|
12137
|
+
}
|
|
12138
|
+
toTurnStreamError(error) {
|
|
12139
|
+
const record = this.toRecord(error);
|
|
12140
|
+
if (record && record['code'] === 'agentic-authoring-timeout') {
|
|
12141
|
+
return error;
|
|
12142
|
+
}
|
|
12143
|
+
if (record && record['code'] === 'agentic-authoring-result-timeout') {
|
|
12144
|
+
return this.streamConnectionError({
|
|
12145
|
+
code: 'agentic-authoring-result-fallback',
|
|
12146
|
+
message: typeof record['message'] === 'string'
|
|
12147
|
+
? record['message']
|
|
12148
|
+
: 'Agentic authoring stream did not deliver a result.',
|
|
12149
|
+
fallbackAuthoringUrl: typeof record['fallbackAuthoringUrl'] === 'string'
|
|
12150
|
+
? record['fallbackAuthoringUrl']
|
|
12151
|
+
: null,
|
|
12152
|
+
});
|
|
12351
12153
|
}
|
|
12352
|
-
|
|
12353
|
-
|
|
12354
|
-
}
|
|
12355
|
-
}
|
|
12356
|
-
consumeBufferedSseFrames(buffer, handleMessage) {
|
|
12357
|
-
let remaining = buffer;
|
|
12358
|
-
let boundary = this.findSseFrameBoundary(remaining);
|
|
12359
|
-
while (boundary) {
|
|
12360
|
-
const frame = remaining.slice(0, boundary.index);
|
|
12361
|
-
remaining = remaining.slice(boundary.index + boundary.length);
|
|
12362
|
-
const data = frame
|
|
12363
|
-
.split(/\r?\n/)
|
|
12364
|
-
.filter((line) => line.startsWith('data:'))
|
|
12365
|
-
.map((line) => line.slice(5).trimStart())
|
|
12366
|
-
.join('\n');
|
|
12367
|
-
if (data) {
|
|
12368
|
-
handleMessage({ data });
|
|
12369
|
-
}
|
|
12370
|
-
boundary = this.findSseFrameBoundary(remaining);
|
|
12154
|
+
if (record && record['praxisAgenticTurnStreamConnectionError'] === true) {
|
|
12155
|
+
return error;
|
|
12371
12156
|
}
|
|
12372
|
-
return
|
|
12157
|
+
return this.streamConnectionError(error);
|
|
12373
12158
|
}
|
|
12374
|
-
|
|
12375
|
-
|
|
12376
|
-
|
|
12377
|
-
|
|
12378
|
-
return null;
|
|
12379
|
-
}
|
|
12380
|
-
if (lf >= 0 && (crlf < 0 || lf < crlf)) {
|
|
12381
|
-
return { index: lf, length: 2 };
|
|
12382
|
-
}
|
|
12383
|
-
return { index: crlf, length: 4 };
|
|
12159
|
+
toRecord(value) {
|
|
12160
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
12161
|
+
? value
|
|
12162
|
+
: null;
|
|
12384
12163
|
}
|
|
12385
12164
|
streamStartTimeoutMs() {
|
|
12386
12165
|
return Math.max(1, this.options?.streamStartTimeoutMs ?? DEFAULT_TURN_STREAM_START_TIMEOUT_MS);
|
|
@@ -12394,27 +12173,6 @@ class PageBuilderAgenticAuthoringService {
|
|
|
12394
12173
|
streamSilenceStatusMs() {
|
|
12395
12174
|
return Math.max(0, this.options?.streamSilenceStatusMs ?? DEFAULT_TURN_STREAM_SILENCE_STATUS_MS);
|
|
12396
12175
|
}
|
|
12397
|
-
streamSilenceStatusEvent(start, elapsedMs, resultFallbackMs) {
|
|
12398
|
-
return {
|
|
12399
|
-
streamId: start.streamId,
|
|
12400
|
-
threadId: start.threadId,
|
|
12401
|
-
turnId: start.turnId,
|
|
12402
|
-
seq: 0,
|
|
12403
|
-
eventSchemaVersion: start.eventSchemaVersion,
|
|
12404
|
-
timestamp: new Date().toISOString(),
|
|
12405
|
-
type: 'status',
|
|
12406
|
-
payload: {
|
|
12407
|
-
phase: 'stream.waiting',
|
|
12408
|
-
summary: 'Still waiting for the backend authoring result...',
|
|
12409
|
-
diagnostics: {
|
|
12410
|
-
source: 'frontend-stream-silence-watchdog',
|
|
12411
|
-
elapsedMs,
|
|
12412
|
-
resultFallbackMs,
|
|
12413
|
-
fallbackAuthoringUrl: start.fallbackAuthoringUrl ?? null,
|
|
12414
|
-
},
|
|
12415
|
-
},
|
|
12416
|
-
};
|
|
12417
|
-
}
|
|
12418
12176
|
streamLifecycleStatusEvent(start, phase, diagnostics) {
|
|
12419
12177
|
return {
|
|
12420
12178
|
streamId: start.streamId,
|
|
@@ -12445,44 +12203,6 @@ class PageBuilderAgenticAuthoringService {
|
|
|
12445
12203
|
cause,
|
|
12446
12204
|
};
|
|
12447
12205
|
}
|
|
12448
|
-
buildStreamUrl(start) {
|
|
12449
|
-
const url = new URL(`${this.baseUrl}/turn/stream/${start.streamId}`, typeof window !== 'undefined' ? window.location.origin : 'http://localhost');
|
|
12450
|
-
if (start.streamAccessToken) {
|
|
12451
|
-
url.searchParams.set('accessToken', start.streamAccessToken);
|
|
12452
|
-
}
|
|
12453
|
-
return /^https?:\/\//i.test(this.baseUrl)
|
|
12454
|
-
? url.toString()
|
|
12455
|
-
: url.pathname + url.search;
|
|
12456
|
-
}
|
|
12457
|
-
buildStreamProbeUrl(start) {
|
|
12458
|
-
const url = new URL(`${this.baseUrl}/turn/stream/${start.streamId}/probe`, typeof window !== 'undefined' ? window.location.origin : 'http://localhost');
|
|
12459
|
-
if (start.streamAccessToken) {
|
|
12460
|
-
url.searchParams.set('accessToken', start.streamAccessToken);
|
|
12461
|
-
}
|
|
12462
|
-
return /^https?:\/\//i.test(this.baseUrl)
|
|
12463
|
-
? url.toString()
|
|
12464
|
-
: url.pathname + url.search;
|
|
12465
|
-
}
|
|
12466
|
-
createEventSource(url) {
|
|
12467
|
-
const factory = this.options?.eventSourceFactory;
|
|
12468
|
-
const options = { withCredentials: true };
|
|
12469
|
-
if (factory) {
|
|
12470
|
-
return factory(url, options);
|
|
12471
|
-
}
|
|
12472
|
-
return new EventSource(url, options);
|
|
12473
|
-
}
|
|
12474
|
-
async probeTurnStreamEndpoint(url, abort) {
|
|
12475
|
-
if (typeof fetch === 'undefined') {
|
|
12476
|
-
return null;
|
|
12477
|
-
}
|
|
12478
|
-
const response = await fetch(url, {
|
|
12479
|
-
method: 'GET',
|
|
12480
|
-
credentials: 'include',
|
|
12481
|
-
cache: 'no-store',
|
|
12482
|
-
signal: abort?.signal,
|
|
12483
|
-
});
|
|
12484
|
-
return response.status;
|
|
12485
|
-
}
|
|
12486
12206
|
formatEtag(etag) {
|
|
12487
12207
|
const trimmed = etag.trim();
|
|
12488
12208
|
return trimmed.startsWith('"') ? trimmed : `"${trimmed}"`;
|
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.102",
|
|
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": "^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.102",
|
|
12
|
+
"@praxisui/core": "^8.0.0-beta.102",
|
|
13
|
+
"@praxisui/settings-panel": "^8.0.0-beta.102",
|
|
14
14
|
"rxjs": "~7.8.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
@@ -1160,25 +1160,12 @@ interface PageBuilderAgenticAuthoringOptions {
|
|
|
1160
1160
|
sharedRuleGetDefinitionTimeline?: (definitionId: string, options?: {
|
|
1161
1161
|
headers?: Record<string, string> | undefined;
|
|
1162
1162
|
}) => Observable<DomainRuleTimelineResponse>;
|
|
1163
|
-
eventSourceFactory?: PageBuilderAgenticAuthoringEventSourceFactory;
|
|
1164
1163
|
requestTimeoutMs?: number;
|
|
1165
1164
|
streamStartTimeoutMs?: number;
|
|
1166
1165
|
streamTurnTimeoutMs?: number;
|
|
1167
1166
|
streamResultFallbackMs?: number;
|
|
1168
1167
|
streamSilenceStatusMs?: number;
|
|
1169
|
-
streamConnectionErrorGraceMs?: number;
|
|
1170
1168
|
}
|
|
1171
|
-
interface PageBuilderAgenticAuthoringEventSource {
|
|
1172
|
-
readonly readyState?: number;
|
|
1173
|
-
onmessage: ((event: MessageEvent<string>) => void) | null;
|
|
1174
|
-
onerror: ((event: Event) => void) | null;
|
|
1175
|
-
addEventListener?(type: string, listener: (event: MessageEvent<string>) => void): void;
|
|
1176
|
-
close(): void;
|
|
1177
|
-
}
|
|
1178
|
-
interface PageBuilderAgenticAuthoringEventSourceOptions {
|
|
1179
|
-
withCredentials?: boolean;
|
|
1180
|
-
}
|
|
1181
|
-
type PageBuilderAgenticAuthoringEventSourceFactory = (url: string, options?: PageBuilderAgenticAuthoringEventSourceOptions) => PageBuilderAgenticAuthoringEventSource;
|
|
1182
1169
|
interface PageBuilderAgenticAuthoringTurnStreamConnectionError {
|
|
1183
1170
|
readonly praxisAgenticTurnStreamConnectionError: true;
|
|
1184
1171
|
readonly cause: unknown;
|
|
@@ -1381,6 +1368,7 @@ interface PageBuilderApplyResult {
|
|
|
1381
1368
|
declare const PAGE_BUILDER_AGENTIC_AUTHORING_OPTIONS: InjectionToken<PageBuilderAgenticAuthoringOptions>;
|
|
1382
1369
|
declare class PageBuilderAgenticAuthoringService {
|
|
1383
1370
|
private readonly http;
|
|
1371
|
+
private readonly turnClient;
|
|
1384
1372
|
private readonly options;
|
|
1385
1373
|
private readonly baseUrl;
|
|
1386
1374
|
private readonly headersFactory;
|
|
@@ -1390,23 +1378,18 @@ declare class PageBuilderAgenticAuthoringService {
|
|
|
1390
1378
|
searchResourceCandidates(request: PageBuilderAgenticAuthoringResourceCandidatesRequest): Observable<PageBuilderAgenticAuthoringResourceCandidatesResult>;
|
|
1391
1379
|
streamTurn(request: PageBuilderAgenticAuthoringTurnStreamRequest): Observable<PageBuilderAgenticAuthoringTurnStreamEvent>;
|
|
1392
1380
|
applyPage(request: PageBuilderApplyRequest): Observable<PageBuilderApplyResult>;
|
|
1381
|
+
private buildHeaderRecord;
|
|
1393
1382
|
private buildHeaders;
|
|
1394
|
-
private
|
|
1395
|
-
private
|
|
1396
|
-
private
|
|
1397
|
-
private findSseFrameBoundary;
|
|
1383
|
+
private toTurnStreamEvent;
|
|
1384
|
+
private toTurnStreamError;
|
|
1385
|
+
private toRecord;
|
|
1398
1386
|
private streamStartTimeoutMs;
|
|
1399
1387
|
private streamTurnTimeoutMs;
|
|
1400
1388
|
private streamResultFallbackMs;
|
|
1401
1389
|
private streamSilenceStatusMs;
|
|
1402
|
-
private streamSilenceStatusEvent;
|
|
1403
1390
|
private streamLifecycleStatusEvent;
|
|
1404
1391
|
private requestTimeoutMs;
|
|
1405
1392
|
private streamConnectionError;
|
|
1406
|
-
private buildStreamUrl;
|
|
1407
|
-
private buildStreamProbeUrl;
|
|
1408
|
-
private createEventSource;
|
|
1409
|
-
private probeTurnStreamEndpoint;
|
|
1410
1393
|
private formatEtag;
|
|
1411
1394
|
private normalizeIntentResolutionResult;
|
|
1412
1395
|
private normalizeStringList;
|
|
@@ -1913,4 +1896,4 @@ declare class DynamicPageBuilderComponent implements OnChanges {
|
|
|
1913
1896
|
}
|
|
1914
1897
|
|
|
1915
1898
|
export { ComponentPaletteDialogComponent, ConfirmDialogComponent, ConnectionEditorComponent, DynamicPageBuilderComponent, DynamicPageConfigEditorComponent, FloatingToolbarComponent, PAGE_BUILDER_AGENTIC_AUTHORING_OPTIONS, PAGE_BUILDER_AI_CAPABILITIES, PAGE_BUILDER_COMPONENT_CONTEXT_PACK, PAGE_BUILDER_WIDGET_AI_CATALOGS, PLACEHOLDER, PRAXIS_PAGE_BUILDER_AUTHORING_MANIFEST, PageBuilderAgenticAuthoringService, PageConfigEditorComponent, TileToolbarComponent, WidgetShellEditorComponent, clearWidgetAiCatalogs, compileUiCompositionPlan, getPageAiCatalog, getWidgetAiCapabilities, providePageBuilderWidgetAiCatalogs, registerWidgetAiCatalog, registerWidgetAiCatalogs, validateUiCompositionPlan };
|
|
1916
|
-
export type { Capability, CapabilityCatalog, CapabilityCategory, ComponentPaletteData, ComponentPaletteSelection, ConfirmDialogData, PageBuilderAgenticAuthoringAttachmentSummary, PageBuilderAgenticAuthoringCandidate, PageBuilderAgenticAuthoringComponentCapabilitiesResult, PageBuilderAgenticAuthoringComponentCapability, PageBuilderAgenticAuthoringComponentCapabilityCatalog, PageBuilderAgenticAuthoringComponentCapabilityExample, PageBuilderAgenticAuthoringComponentFieldAlias, PageBuilderAgenticAuthoringConversationMessage,
|
|
1899
|
+
export type { Capability, CapabilityCatalog, CapabilityCategory, ComponentPaletteData, ComponentPaletteSelection, ConfirmDialogData, PageBuilderAgenticAuthoringAttachmentSummary, PageBuilderAgenticAuthoringCandidate, PageBuilderAgenticAuthoringComponentCapabilitiesResult, PageBuilderAgenticAuthoringComponentCapability, PageBuilderAgenticAuthoringComponentCapabilityCatalog, PageBuilderAgenticAuthoringComponentCapabilityExample, PageBuilderAgenticAuthoringComponentFieldAlias, PageBuilderAgenticAuthoringConversationMessage, PageBuilderAgenticAuthoringGateResult, PageBuilderAgenticAuthoringIntentResolutionRequest, PageBuilderAgenticAuthoringIntentResolutionResult, PageBuilderAgenticAuthoringOptions, PageBuilderAgenticAuthoringPendingClarification, PageBuilderAgenticAuthoringPromptRequest, PageBuilderAgenticAuthoringProvider, PageBuilderAgenticAuthoringQuickReply, PageBuilderAgenticAuthoringResourceCandidatesRequest, PageBuilderAgenticAuthoringResourceCandidatesResult, PageBuilderAgenticAuthoringSharedRuleHandoff, PageBuilderAgenticAuthoringTarget, PageBuilderAgenticAuthoringTurnStreamConnectionError, PageBuilderAgenticAuthoringTurnStreamEvent, PageBuilderAgenticAuthoringTurnStreamRequest, PageBuilderAgenticAuthoringTurnStreamStartResponse, PageBuilderApplyRequest, PageBuilderApplyResult, PageBuilderCompiledFormPatch, PageBuilderMinimalFormPlanResult, PageBuilderPreviewDiagnostics, PageBuilderPreviewResult, PageBuilderProjectKnowledgeAudit, UiCompositionPlan, UiCompositionPlanBinding, UiCompositionPlanCompileResult, UiCompositionPlanComponentPortEndpoint, UiCompositionPlanDiagnostic, UiCompositionPlanEndpoint, UiCompositionPlanGlobalActionEndpoint, UiCompositionPlanInputSource, UiCompositionPlanSourceEndpoint, UiCompositionPlanStateEndpoint, UiCompositionPlanTargetEndpoint, UiCompositionPlanTransform, UiCompositionPlanWidget, ValueKind };
|