@praxisui/ai 7.0.0-beta.0 → 8.0.0-beta.1

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/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import * as i0 from '@angular/core';
2
- import { OnDestroy, ElementRef, OnInit, ChangeDetectorRef } from '@angular/core';
3
- import { Schema } from '@google/generative-ai';
2
+ import { InjectionToken, OnDestroy, ElementRef, OnChanges, EventEmitter, SimpleChanges, OnInit, ChangeDetectorRef } from '@angular/core';
3
+ import * as rxjs from 'rxjs';
4
4
  import { Observable } from 'rxjs';
5
- import { CdkOverlayOrigin } from '@angular/cdk/overlay';
5
+ import { Schema } from '@google/generative-ai';
6
+ import { ConnectedPosition, CdkOverlayOrigin } from '@angular/cdk/overlay';
6
7
  import * as _praxisui_ai from '@praxisui/ai';
7
8
  import { MatDialogRef } from '@angular/material/dialog';
8
9
  import { MatSnackBar } from '@angular/material/snack-bar';
@@ -12,6 +13,13 @@ declare class PraxisAi {
12
13
  static ɵcmp: i0.ɵɵComponentDeclaration<PraxisAi, "lib-praxis-ai", never, {}, {}, never, never, true, never>;
13
14
  }
14
15
 
16
+ /**
17
+ * Generated from praxis-config-starter/docs/ai/contracts/praxis-ai-api-contract-v1.1.openapi.yaml.
18
+ * Do not edit manually. Run praxis-config-starter/tools/contracts/generate-ai-contract-bindings.js.
19
+ */
20
+ declare const AI_CONTRACT_VERSION: "v1.1";
21
+ declare const AI_CONTRACT_SCHEMA_HASH: "922e6d48637e64b403562d6d7cb833ed4942ffb0b452ec3573255871f4ec8739";
22
+ declare const AI_STREAM_EVENT_SCHEMA_VERSION: "v1";
15
23
  declare const AI_STREAM_EVENT_TYPES: readonly ["status", "thought.step", "heartbeat", "result", "error", "cancelled"];
16
24
  type AiJsonPrimitive = string | number | boolean | null;
17
25
  type AiJsonArray = AiJsonValue[];
@@ -98,6 +106,7 @@ interface AiOrchestratorResponseContract {
98
106
  contractVersion?: string | null;
99
107
  schemaHash?: string | null;
100
108
  patch?: AiJsonObject | null;
109
+ componentEditPlan?: AiJsonObject | null;
101
110
  diff?: AiPatchDiffContract[] | null;
102
111
  explanation?: string | null;
103
112
  warnings?: string[] | null;
@@ -113,6 +122,116 @@ interface AiOrchestratorResponseContract {
113
122
  allowedValues?: string[] | null;
114
123
  memory?: AiMemoryInfoContract;
115
124
  }
125
+ interface AgenticAuthoringConversationMessageContract {
126
+ id?: string | null;
127
+ role: 'user' | 'assistant' | 'system';
128
+ text?: string | null;
129
+ createdAt?: string | null;
130
+ }
131
+ interface AgenticAuthoringPendingClarificationContract {
132
+ sourcePrompt?: string | null;
133
+ questions?: string[];
134
+ assistantMessage?: string | null;
135
+ clientTurnId?: string | null;
136
+ diagnostics?: AiJsonObject | null;
137
+ }
138
+ interface AgenticAuthoringAttachmentSummaryContract {
139
+ id: string;
140
+ name: string;
141
+ kind: string;
142
+ mimeType?: string | null;
143
+ sizeBytes?: number | null;
144
+ source?: string | null;
145
+ hasPreview?: boolean;
146
+ }
147
+ interface AgenticAuthoringConversationContextContract {
148
+ sessionId?: string | null;
149
+ clientTurnId?: string | null;
150
+ conversationMessages?: AgenticAuthoringConversationMessageContract[];
151
+ pendingClarification?: AgenticAuthoringPendingClarificationContract | null;
152
+ attachmentSummaries?: AgenticAuthoringAttachmentSummaryContract[];
153
+ }
154
+ interface AgenticAuthoringIntentResolutionRequestContract extends AgenticAuthoringConversationContextContract {
155
+ userPrompt: string;
156
+ targetApp?: string | null;
157
+ targetComponentId?: string | null;
158
+ currentRoute?: string | null;
159
+ currentPage?: AiJsonObject | null;
160
+ selectedWidgetKey?: string | null;
161
+ provider?: string | null;
162
+ model?: string | null;
163
+ apiKey?: string | null;
164
+ }
165
+ interface AgenticAuthoringCandidateContract {
166
+ resourcePath?: string | null;
167
+ operation?: string | null;
168
+ schemaUrl?: string | null;
169
+ submitUrl?: string | null;
170
+ submitMethod?: string | null;
171
+ score?: number | null;
172
+ reason?: string | null;
173
+ evidence?: string[] | null;
174
+ [key: string]: AiJsonValue | undefined;
175
+ }
176
+ interface AgenticAuthoringQuickReplyContract {
177
+ id: string;
178
+ kind: string;
179
+ label: string;
180
+ prompt: string;
181
+ [key: string]: AiJsonValue | undefined;
182
+ }
183
+ interface AgenticAuthoringIntentResolutionResultContract {
184
+ valid?: boolean;
185
+ operationKind?: string | null;
186
+ artifactKind?: string | null;
187
+ changeKind?: string | null;
188
+ selectedCandidate?: AgenticAuthoringCandidateContract | null;
189
+ candidates?: AgenticAuthoringCandidateContract[];
190
+ gate?: AiJsonObject | null;
191
+ effectivePrompt?: string | null;
192
+ assistantMessage?: string | null;
193
+ quickReplies?: AgenticAuthoringQuickReplyContract[];
194
+ pendingClarification?: AgenticAuthoringPendingClarificationContract | null;
195
+ clarificationQuestions?: string[];
196
+ warnings?: string[];
197
+ failureCodes?: string[];
198
+ [key: string]: AiJsonValue | AgenticAuthoringCandidateContract | AgenticAuthoringCandidateContract[] | AgenticAuthoringQuickReplyContract | AgenticAuthoringQuickReplyContract[] | AgenticAuthoringPendingClarificationContract | undefined;
199
+ }
200
+ interface AgenticAuthoringPlanRequestContract extends AgenticAuthoringConversationContextContract {
201
+ userPrompt: string;
202
+ provider?: string | null;
203
+ model?: string | null;
204
+ apiKey?: string | null;
205
+ currentPage?: AiJsonObject | null;
206
+ intentResolution?: AgenticAuthoringIntentResolutionResultContract | null;
207
+ }
208
+ interface AgenticAuthoringPreviewResultContract {
209
+ valid?: boolean;
210
+ warnings?: string[];
211
+ minimalFormPlan?: AiJsonObject | null;
212
+ compiledFormPatch?: AiJsonObject | null;
213
+ uiCompositionPlan?: AiJsonObject | null;
214
+ diagnostics?: AiJsonObject | null;
215
+ [key: string]: AiJsonValue | undefined;
216
+ }
217
+ interface AgenticAuthoringApplyRequestContract {
218
+ componentType: string;
219
+ componentId: string;
220
+ scope?: string | null;
221
+ payload: AiJsonObject;
222
+ tags?: AiJsonObject | null;
223
+ [key: string]: AiJsonValue | undefined;
224
+ }
225
+ interface AgenticAuthoringApplyResultContract {
226
+ applied?: boolean;
227
+ etag?: string | null;
228
+ [key: string]: AiJsonValue | undefined;
229
+ }
230
+ interface AgenticAuthoringComponentCapabilitiesResultContract {
231
+ version?: string | null;
232
+ catalogs?: AiJsonObject[];
233
+ [key: string]: AiJsonValue | undefined;
234
+ }
116
235
  interface AiPatchStreamStartResponseContract {
117
236
  streamId: string;
118
237
  threadId: string;
@@ -141,6 +260,15 @@ interface AiPatchStreamEnvelopeContract<TPayload extends AiJsonObject = AiJsonOb
141
260
  type: AiPatchStreamEventType$1;
142
261
  payload: TPayload;
143
262
  }
263
+ interface ProblemResponseContract {
264
+ timestamp?: string | null;
265
+ status?: number | null;
266
+ error?: string | null;
267
+ message?: string | null;
268
+ path?: string | null;
269
+ detail?: string | null;
270
+ [key: string]: AiJsonValue | undefined;
271
+ }
144
272
  type AiPatchStreamEventType$1 = (typeof AI_STREAM_EVENT_TYPES)[number];
145
273
 
146
274
  /**
@@ -282,6 +410,188 @@ interface RulePropertyDefinition {
282
410
  }
283
411
  type RulePropertySchema = Record<'field' | 'section' | 'action' | 'row' | 'column', RulePropertyDefinition[]>;
284
412
 
413
+ type PraxisAssistantShellMessageRole = 'user' | 'assistant' | 'system' | 'status' | 'error';
414
+ type PraxisAssistantShellMode = 'config' | 'agentic-authoring' | 'chat' | 'diagnostic' | 'review' | 'inline-help';
415
+ type PraxisAssistantShellState = 'idle' | 'listening' | 'processing' | 'clarification' | 'review' | 'applying' | 'success' | 'error';
416
+ interface PraxisAssistantShellMessage {
417
+ id: string;
418
+ role: PraxisAssistantShellMessageRole;
419
+ text: string;
420
+ status?: 'pending' | 'done' | 'error';
421
+ editable?: boolean;
422
+ resendable?: boolean;
423
+ actions?: readonly PraxisAssistantShellMessageAction[];
424
+ }
425
+ interface PraxisAssistantShellQuickReply {
426
+ id: string;
427
+ label: string;
428
+ prompt: string;
429
+ kind?: string;
430
+ }
431
+ interface PraxisAssistantShellMessageAction {
432
+ id: string;
433
+ label: string;
434
+ kind?: 'edit' | 'resend' | 'copy' | 'custom' | string;
435
+ disabled?: boolean;
436
+ }
437
+ interface PraxisAssistantShellContextItem {
438
+ id: string;
439
+ label: string;
440
+ value?: string;
441
+ kind?: 'component' | 'schema' | 'selection' | 'route' | 'tenant' | 'mode' | 'custom' | string;
442
+ icon?: string;
443
+ }
444
+ interface PraxisAssistantShellAttachment {
445
+ id: string;
446
+ name: string;
447
+ kind: 'image' | 'file' | 'json' | 'schema' | 'text' | string;
448
+ mimeType?: string;
449
+ sizeBytes?: number;
450
+ file?: File;
451
+ previewUrl?: string;
452
+ source?: 'paste' | 'file-picker' | 'host' | string;
453
+ status?: 'ready' | 'uploading' | 'error';
454
+ error?: string;
455
+ }
456
+ interface PraxisAssistantShellLayout {
457
+ left: number;
458
+ top: number;
459
+ width: number;
460
+ height: number;
461
+ }
462
+ interface PraxisAssistantShellLabels {
463
+ title: string;
464
+ subtitle?: string;
465
+ close: string;
466
+ prompt: string;
467
+ promptPlaceholder: string;
468
+ emptyConversation: string;
469
+ submit: string;
470
+ apply: string;
471
+ conversationAria: string;
472
+ quickRepliesAria: string;
473
+ dragHandleAria: string;
474
+ resizeHandleAria: string;
475
+ contextAria: string;
476
+ attachmentsAria: string;
477
+ attach: string;
478
+ removeAttachment: string;
479
+ editMessage: string;
480
+ resendMessage: string;
481
+ modeConfig: string;
482
+ modeAgenticAuthoring: string;
483
+ modeChat: string;
484
+ modeDiagnostic: string;
485
+ modeReview: string;
486
+ modeInlineHelp: string;
487
+ stateIdle: string;
488
+ stateListening: string;
489
+ stateProcessing: string;
490
+ stateClarification: string;
491
+ stateReview: string;
492
+ stateApplying: string;
493
+ stateSuccess: string;
494
+ stateError: string;
495
+ }
496
+
497
+ type PraxisAssistantTurnPhase = 'capture' | 'contextualize' | 'clarify' | 'plan' | 'preview' | 'review' | 'apply' | 'summarize';
498
+ type PraxisAssistantClarificationQuestionType = 'text' | 'single-choice' | 'multi-choice' | 'confirm' | 'resource' | 'field' | 'schema' | 'date-range' | 'number' | 'color' | 'component';
499
+ interface PraxisAssistantClarificationOption {
500
+ id: string;
501
+ label: string;
502
+ value: string;
503
+ description?: string;
504
+ contextHints?: Record<string, unknown>;
505
+ }
506
+ interface PraxisAssistantClarificationQuestion {
507
+ id: string;
508
+ type: PraxisAssistantClarificationQuestionType;
509
+ label: string;
510
+ description?: string;
511
+ required?: boolean;
512
+ allowCustom?: boolean;
513
+ options?: readonly PraxisAssistantClarificationOption[];
514
+ }
515
+ interface PraxisAssistantTurnAction {
516
+ kind: 'submit' | 'clarify' | 'apply' | 'cancel' | 'retry' | 'edit-message' | 'resend-message' | 'attach' | 'remove-attachment' | string;
517
+ id?: string;
518
+ value?: unknown;
519
+ contextHints?: Record<string, unknown>;
520
+ }
521
+ interface PraxisAssistantPendingClarification {
522
+ sourcePrompt: string;
523
+ questions: readonly PraxisAssistantClarificationQuestion[];
524
+ assistantMessage?: string;
525
+ clientTurnId?: string;
526
+ diagnostics?: Record<string, unknown>;
527
+ }
528
+ interface PraxisAssistantTurnRequest {
529
+ mode: PraxisAssistantShellMode;
530
+ phase?: PraxisAssistantTurnPhase;
531
+ prompt?: string;
532
+ action?: PraxisAssistantTurnAction;
533
+ sessionId?: string;
534
+ clientTurnId?: string;
535
+ componentId?: string;
536
+ componentType?: string;
537
+ messages?: readonly PraxisAssistantShellMessage[];
538
+ contextItems?: readonly PraxisAssistantShellContextItem[];
539
+ attachments?: readonly PraxisAssistantShellAttachment[];
540
+ currentState?: unknown;
541
+ runtimeState?: unknown;
542
+ schemaFields?: unknown;
543
+ dataProfile?: unknown;
544
+ contextHints?: Record<string, unknown>;
545
+ preview?: unknown;
546
+ pendingPatch?: unknown;
547
+ pendingClarification?: PraxisAssistantPendingClarification;
548
+ }
549
+ interface PraxisAssistantTurnResult {
550
+ state: PraxisAssistantShellState;
551
+ phase?: PraxisAssistantTurnPhase;
552
+ assistantMessage?: string;
553
+ messages?: readonly PraxisAssistantShellMessage[];
554
+ quickReplies?: readonly PraxisAssistantShellQuickReply[];
555
+ clarificationQuestions?: readonly PraxisAssistantClarificationQuestion[];
556
+ contextItems?: readonly PraxisAssistantShellContextItem[];
557
+ attachments?: readonly PraxisAssistantShellAttachment[];
558
+ canApply?: boolean;
559
+ statusText?: string;
560
+ errorText?: string;
561
+ preview?: unknown;
562
+ pendingPatch?: unknown;
563
+ pendingClarification?: PraxisAssistantPendingClarification | null;
564
+ sessionId?: string;
565
+ clientTurnId?: string;
566
+ diagnostics?: Record<string, unknown>;
567
+ }
568
+ interface PraxisAssistantTurnViewState {
569
+ mode: PraxisAssistantShellMode;
570
+ state: PraxisAssistantShellState;
571
+ phase: PraxisAssistantTurnPhase;
572
+ sessionId?: string;
573
+ clientTurnId?: string;
574
+ messages: PraxisAssistantShellMessage[];
575
+ quickReplies: PraxisAssistantShellQuickReply[];
576
+ clarificationQuestions: PraxisAssistantClarificationQuestion[];
577
+ contextItems: PraxisAssistantShellContextItem[];
578
+ attachments: PraxisAssistantShellAttachment[];
579
+ canApply: boolean;
580
+ statusText: string;
581
+ errorText: string;
582
+ preview?: unknown;
583
+ pendingPatch?: unknown;
584
+ pendingClarification?: PraxisAssistantPendingClarification;
585
+ diagnostics?: Record<string, unknown>;
586
+ }
587
+ interface PraxisAssistantTurnFlow {
588
+ readonly mode: PraxisAssistantShellMode;
589
+ submit(request: PraxisAssistantTurnRequest): Promise<PraxisAssistantTurnResult> | rxjs.Observable<PraxisAssistantTurnResult>;
590
+ apply?(request: PraxisAssistantTurnRequest): Promise<PraxisAssistantTurnResult> | rxjs.Observable<PraxisAssistantTurnResult>;
591
+ cancel?(request: PraxisAssistantTurnRequest): Promise<PraxisAssistantTurnResult> | rxjs.Observable<PraxisAssistantTurnResult>;
592
+ retry?(request: PraxisAssistantTurnRequest): Promise<PraxisAssistantTurnResult> | rxjs.Observable<PraxisAssistantTurnResult>;
593
+ }
594
+
285
595
  interface PatchResult {
286
596
  success: boolean;
287
597
  warnings?: string[];
@@ -300,6 +610,13 @@ interface AiSuggestion {
300
610
  contextHints?: Record<string, unknown> | null;
301
611
  missingContext?: string[];
302
612
  }
613
+ interface AiResponseCompileResult {
614
+ patch?: AiJsonObject;
615
+ explanation?: string;
616
+ type?: 'error';
617
+ message?: string;
618
+ warnings?: string[];
619
+ }
303
620
  /**
304
621
  * Contrato fundamental para qualquer componente que suporte configuração via IA.
305
622
  * O Agente de IA usa esta interface para Ler (Introspecção) e Escrever (Patching) no componente.
@@ -352,12 +669,24 @@ interface AiConfigAdapter<TConfig = any> {
352
669
  * Usado para sugestões heurísticas mais precisas no backend.
353
670
  */
354
671
  getSchemaFields?(): Record<string, any>[];
672
+ /**
673
+ * Retorna contexto declarativo adicional para authoring assistido por IA.
674
+ * Deve conter contratos validaveis e instrucoes especificas do componente
675
+ * que o backend pode incluir em contextHints sem conhecer a lib concreta.
676
+ */
677
+ getAuthoringContext?(): AiJsonObject | null | undefined;
355
678
  /**
356
679
  * Retorna um snapshot do estado de tempo de execução (volátil).
357
680
  * Ex: { rowCount: 50, isLoading: false, sort: 'name:asc' }.
358
681
  * Usado para responder perguntas do usuário ("Por que está vazio?").
359
- */
682
+ */
360
683
  getRuntimeState?(): Record<string, any>;
684
+ /**
685
+ * Compila respostas declarativas especificas do componente em patch canonico.
686
+ * Ex.: uma tabela pode transformar "componentEditPlan" em alteracoes validadas de colunas.
687
+ * Retorne null/undefined quando a resposta ja estiver no contrato comum do assistente.
688
+ */
689
+ compileAiResponse?(response: Record<string, unknown>): AiResponseCompileResult | null | undefined;
361
690
  /**
362
691
  * Cria um snapshot do estado atual para fins de Undo.
363
692
  * Retorna um token opaco (pode ser o config JSON completo ou um ID).
@@ -392,6 +721,8 @@ declare abstract class BaseAiAdapter<TConfig = any> implements AiConfigAdapter<T
392
721
  getSuggestions(_forceReload?: boolean): Promise<AiSuggestion[]>;
393
722
  getSuggestionContext?(): Record<string, any>;
394
723
  getRuntimeState?(): Record<string, any>;
724
+ getAuthoringContext?(): Record<string, any> | null;
725
+ compileAiResponse?(_response: Record<string, unknown>): AiResponseCompileResult | null;
395
726
  /**
396
727
  * Helper to validate a patch against the capabilities catalog.
397
728
  * Removes keys that are not in the allowed paths.
@@ -435,8 +766,36 @@ declare class SchemaMinifierService {
435
766
  static ɵprov: i0.ɵɵInjectableDeclaration<SchemaMinifierService>;
436
767
  }
437
768
 
769
+ interface PraxisAiConfigSource {
770
+ getAiConfigSnapshot?: () => Partial<AiIntegrationConfig> | null | undefined;
771
+ aiConfigChanges$?: Observable<Partial<AiIntegrationConfig> | null>;
772
+ }
773
+ declare class PraxisAiService {
774
+ private readonly configSource;
775
+ private genAI;
776
+ private config;
777
+ constructor(configSource: PraxisAiConfigSource | null);
778
+ private syncConfig;
779
+ classifyIntent(userInput: string, columns: string[]): Observable<any>;
780
+ answerQuestion(userInput: string, targetConfig: any): Observable<string>;
781
+ executeEnrichedPrompt(userInput: string, contextDescription: string, targetConfig: any, capabilities: any): Observable<any>;
782
+ private formatCapabilities;
783
+ generateContent(prompt: string, modelName?: string): Observable<string>;
784
+ generateContentStream(prompt: string, modelName?: string): Observable<string>;
785
+ generateJson<T>(prompt: string, modelName?: string, schema?: any): Observable<T | null>;
786
+ isMockMode(): boolean;
787
+ private extractUserIntent;
788
+ private getMockPatch;
789
+ listModels(apiKey?: string): Observable<AiModel[]>;
790
+ testConnection(apiKey?: string, model?: string): Observable<boolean>;
791
+ private resolveProvider;
792
+ private isGeminiProvider;
793
+ static ɵfac: i0.ɵɵFactoryDeclaration<PraxisAiService, [{ optional: true; }]>;
794
+ static ɵprov: i0.ɵɵInjectableDeclaration<PraxisAiService>;
795
+ }
796
+
438
797
  declare const AI_INTENT_CONTRACT_VERSION: "v1.1";
439
- declare const AI_INTENT_CONTRACT_SCHEMA_HASH: "51b7901f1df633d89fc019a2e41f675cc5b87b135dfc8335aa96e53205034b26";
798
+ declare const AI_INTENT_CONTRACT_SCHEMA_HASH: "922e6d48637e64b403562d6d7cb833ed4942ffb0b452ec3573255871f4ec8739";
440
799
  type AiSchemaContext = AiSchemaContextContract;
441
800
  interface AiSuggestionsRequest {
442
801
  componentId: string;
@@ -555,6 +914,18 @@ interface AiGlobalConfigSnapshot {
555
914
  gatewayUrl?: string;
556
915
  riskPolicy?: string;
557
916
  }
917
+ interface AiBackendConfigStore {
918
+ getAiConfigSnapshot?: () => AiGlobalConfigSnapshot | null | undefined;
919
+ aiConfigChanges$?: Observable<AiGlobalConfigSnapshot | null>;
920
+ saveAiConfig?: (config: AiGlobalConfigSnapshot) => Promise<void>;
921
+ }
922
+ interface AiBackendStorageOptions {
923
+ headersFactory?: () => Record<string, string | undefined>;
924
+ defaultHeaders?: Record<string, string>;
925
+ allowLocalIdentityFallback?: boolean;
926
+ }
927
+ declare const AI_BACKEND_CONFIG_STORE: InjectionToken<AiBackendConfigStore>;
928
+ declare const AI_BACKEND_STORAGE_OPTIONS: InjectionToken<AiBackendStorageOptions>;
558
929
  declare class AiBackendApiService {
559
930
  private readonly http;
560
931
  private readonly globalConfigStore;
@@ -612,6 +983,61 @@ declare class AiResponseValidatorService {
612
983
  static ɵprov: i0.ɵɵInjectableDeclaration<AiResponseValidatorService>;
613
984
  }
614
985
 
986
+ interface PraxisAssistantTurnControllerOptions {
987
+ componentId?: string;
988
+ componentType?: string;
989
+ sessionId?: string;
990
+ contextItems?: readonly PraxisAssistantShellContextItem[];
991
+ attachments?: readonly PraxisAssistantShellAttachment[];
992
+ currentState?: unknown;
993
+ runtimeState?: unknown;
994
+ schemaFields?: unknown;
995
+ dataProfile?: unknown;
996
+ contextHints?: Record<string, unknown>;
997
+ }
998
+ declare class PraxisAssistantTurnOrchestratorService {
999
+ createController(flow: PraxisAssistantTurnFlow, options?: PraxisAssistantTurnControllerOptions): PraxisAssistantTurnController;
1000
+ static ɵfac: i0.ɵɵFactoryDeclaration<PraxisAssistantTurnOrchestratorService, never>;
1001
+ static ɵprov: i0.ɵɵInjectableDeclaration<PraxisAssistantTurnOrchestratorService>;
1002
+ }
1003
+ declare class PraxisAssistantTurnController {
1004
+ private readonly flow;
1005
+ private readonly options;
1006
+ private readonly stateSubject;
1007
+ readonly state$: Observable<PraxisAssistantTurnViewState>;
1008
+ constructor(flow: PraxisAssistantTurnFlow, options: PraxisAssistantTurnControllerOptions);
1009
+ snapshot(): PraxisAssistantTurnViewState;
1010
+ setContextItems(items: readonly PraxisAssistantShellContextItem[]): void;
1011
+ setMessages(messages: readonly PraxisAssistantShellMessage[]): void;
1012
+ setAttachments(attachments: readonly PraxisAssistantShellAttachment[]): void;
1013
+ addAttachment(attachment: PraxisAssistantShellAttachment): void;
1014
+ removeAttachment(id: string): void;
1015
+ editMessage(messageId: string, text: string): void;
1016
+ resendMessage(messageId: string): Observable<PraxisAssistantTurnViewState>;
1017
+ submitEditedMessage(messageId: string, text: string): Observable<PraxisAssistantTurnViewState>;
1018
+ submitPrompt(prompt: string, action?: PraxisAssistantTurnAction): Observable<PraxisAssistantTurnViewState>;
1019
+ answerClarification(option: PraxisAssistantClarificationOption | string): Observable<PraxisAssistantTurnViewState>;
1020
+ apply(): Observable<PraxisAssistantTurnViewState>;
1021
+ retry(): Observable<PraxisAssistantTurnViewState>;
1022
+ cancel(): Observable<PraxisAssistantTurnViewState>;
1023
+ private runFlow;
1024
+ private buildRequest;
1025
+ private submitExistingUserMessage;
1026
+ private findUserMessageIndex;
1027
+ private resetReplayState;
1028
+ private applyResult;
1029
+ private resolveSubmitAction;
1030
+ private buildPendingClarification;
1031
+ private resolvePendingClarificationSourcePrompt;
1032
+ private resolveMessageRole;
1033
+ private resolvePhase;
1034
+ private buildMessage;
1035
+ private createId;
1036
+ private patchState;
1037
+ private cloneState;
1038
+ private toObservable;
1039
+ }
1040
+
615
1041
  type AssistantMessageRole = 'user' | 'assistant' | 'system';
616
1042
  interface AssistantHistoryMessage {
617
1043
  id: string;
@@ -666,6 +1092,7 @@ declare class PraxisAiAssistantComponent implements OnDestroy {
666
1092
  adapter: AiConfigAdapter;
667
1093
  riskPolicy: RiskPolicy | null;
668
1094
  allowManualPatchEdit: boolean;
1095
+ readonly overlayPositions: ConnectedPosition[];
669
1096
  overlayOrigin: CdkOverlayOrigin;
670
1097
  triggerButton?: ElementRef<HTMLButtonElement>;
671
1098
  inputElement: ElementRef<HTMLInputElement>;
@@ -937,6 +1364,7 @@ declare class PraxisAiAssistantComponent implements OnDestroy {
937
1364
  private closeActiveStreamConnection;
938
1365
  private resetStreamTracking;
939
1366
  private shouldFallbackToPatch;
1367
+ private compileAdapterResponse;
940
1368
  private handlePatchResponse;
941
1369
  private initHistory;
942
1370
  private buildHistoryWarnings;
@@ -1038,33 +1466,98 @@ declare class PraxisAiAssistantComponent implements OnDestroy {
1038
1466
  static ɵcmp: i0.ɵɵComponentDeclaration<PraxisAiAssistantComponent, "praxis-ai-assistant", never, { "adapter": { "alias": "adapter"; "required": true; }; "riskPolicy": { "alias": "riskPolicy"; "required": false; }; "allowManualPatchEdit": { "alias": "allowManualPatchEdit"; "required": false; }; }, {}, never, never, true, never>;
1039
1467
  }
1040
1468
 
1041
- interface PraxisAiConfigSource {
1042
- getAiConfigSnapshot?: () => Partial<AiIntegrationConfig> | null | undefined;
1043
- aiConfigChanges$?: Observable<Partial<AiIntegrationConfig> | null>;
1044
- }
1045
- declare class PraxisAiService {
1046
- private readonly configSource;
1047
- private genAI;
1048
- private config;
1049
- constructor(configSource: PraxisAiConfigSource | null);
1050
- private syncConfig;
1051
- classifyIntent(userInput: string, columns: string[]): Observable<any>;
1052
- answerQuestion(userInput: string, targetConfig: any): Observable<string>;
1053
- executeEnrichedPrompt(userInput: string, contextDescription: string, targetConfig: any, capabilities: any): Observable<any>;
1054
- private formatCapabilities;
1055
- private normalizeIntentClassification;
1056
- generateContent(prompt: string, modelName?: string): Observable<string>;
1057
- generateContentStream(prompt: string, modelName?: string): Observable<string>;
1058
- generateJson<T>(prompt: string, modelName?: string, schema?: any): Observable<T | null>;
1059
- isMockMode(): boolean;
1060
- private extractUserIntent;
1061
- private getMockPatch;
1062
- listModels(apiKey?: string): Observable<AiModel[]>;
1063
- testConnection(apiKey?: string, model?: string): Observable<boolean>;
1064
- private resolveProvider;
1065
- private isGeminiProvider;
1066
- static ɵfac: i0.ɵɵFactoryDeclaration<PraxisAiService, [{ optional: true; }]>;
1067
- static ɵprov: i0.ɵɵInjectableDeclaration<PraxisAiService>;
1469
+ declare class PraxisAiAssistantShellComponent implements OnChanges, OnDestroy {
1470
+ labels: Partial<PraxisAssistantShellLabels> | null;
1471
+ mode: PraxisAssistantShellMode;
1472
+ state: PraxisAssistantShellState;
1473
+ contextItems: readonly PraxisAssistantShellContextItem[];
1474
+ attachments: readonly PraxisAssistantShellAttachment[];
1475
+ messages: readonly PraxisAssistantShellMessage[];
1476
+ quickReplies: readonly PraxisAssistantShellQuickReply[];
1477
+ prompt: string;
1478
+ statusText: string;
1479
+ errorText: string;
1480
+ testIdPrefix: string;
1481
+ panelTestId: string;
1482
+ submitTestId: string;
1483
+ applyTestId: string;
1484
+ busy: boolean;
1485
+ canSubmit: boolean;
1486
+ canApply: boolean;
1487
+ submitOnEnter: boolean;
1488
+ enableFileAttachments: boolean;
1489
+ attachmentAccept: string;
1490
+ attachmentMultiple: boolean;
1491
+ draggable: boolean;
1492
+ resizable: boolean;
1493
+ minWidth: number;
1494
+ minHeight: number;
1495
+ margin: number;
1496
+ layout: PraxisAssistantShellLayout;
1497
+ promptChange: EventEmitter<string>;
1498
+ submitPrompt: EventEmitter<string>;
1499
+ apply: EventEmitter<void>;
1500
+ close: EventEmitter<void>;
1501
+ attach: EventEmitter<void>;
1502
+ attachmentsPasted: EventEmitter<PraxisAssistantShellAttachment[]>;
1503
+ attachmentsSelected: EventEmitter<PraxisAssistantShellAttachment[]>;
1504
+ removeAttachment: EventEmitter<PraxisAssistantShellAttachment>;
1505
+ messageAction: EventEmitter<{
1506
+ message: PraxisAssistantShellMessage;
1507
+ action: PraxisAssistantShellMessageAction;
1508
+ }>;
1509
+ editMessage: EventEmitter<PraxisAssistantShellMessage>;
1510
+ resendMessage: EventEmitter<PraxisAssistantShellMessage>;
1511
+ quickReply: EventEmitter<PraxisAssistantShellQuickReply>;
1512
+ layoutChange: EventEmitter<PraxisAssistantShellLayout>;
1513
+ panel?: ElementRef<HTMLElement>;
1514
+ conversation?: ElementRef<HTMLElement>;
1515
+ private readonly cdr;
1516
+ protected currentPrompt: string;
1517
+ protected resolvedLabels: PraxisAssistantShellLabels;
1518
+ protected currentLayout: PraxisAssistantShellLayout;
1519
+ private pointerSession;
1520
+ private readonly ownedPreviewUrls;
1521
+ private readonly onWindowPointerMove;
1522
+ private readonly onWindowPointerUp;
1523
+ ngOnChanges(changes: SimpleChanges): void;
1524
+ ngOnDestroy(): void;
1525
+ protected onPromptInput(value: string): void;
1526
+ protected onSubmit(): void;
1527
+ protected onPromptKeydown(event: KeyboardEvent): void;
1528
+ protected onPromptPaste(event: ClipboardEvent): void;
1529
+ protected onAttachClick(fileInput: HTMLInputElement): void;
1530
+ protected onAttachmentFilesSelected(event: Event): void;
1531
+ protected onApply(): void;
1532
+ protected onQuickReply(reply: PraxisAssistantShellQuickReply): void;
1533
+ protected onRemoveAttachment(attachment: PraxisAssistantShellAttachment): void;
1534
+ protected onMessageAction(message: PraxisAssistantShellMessage, action: PraxisAssistantShellMessageAction): void;
1535
+ protected getModeLabel(): string;
1536
+ protected getStateLabel(): string;
1537
+ protected startDrag(event: PointerEvent): void;
1538
+ protected startResize(event: PointerEvent): void;
1539
+ protected trackMessage(_index: number, message: PraxisAssistantShellMessage): string;
1540
+ protected trackMessageAction(_index: number, action: PraxisAssistantShellMessageAction): string;
1541
+ protected trackQuickReply(_index: number, reply: PraxisAssistantShellQuickReply): string;
1542
+ protected trackContextItem(_index: number, item: PraxisAssistantShellContextItem): string;
1543
+ protected trackAttachment(_index: number, attachment: PraxisAssistantShellAttachment): string;
1544
+ private startPointerSession;
1545
+ private handlePointerMove;
1546
+ private finishPointerSession;
1547
+ private detachPointerListeners;
1548
+ private resolveBounds;
1549
+ private normalizeLayout;
1550
+ private clampLayout;
1551
+ private clamp;
1552
+ private scheduleConversationScroll;
1553
+ private fileAttachment;
1554
+ private createAttachmentId;
1555
+ private attachmentKind;
1556
+ private revokeDetachedPastedPreviewUrls;
1557
+ private revokeAllOwnedPreviewUrls;
1558
+ private revokeOwnedPreviewUrl;
1559
+ static ɵfac: i0.ɵɵFactoryDeclaration<PraxisAiAssistantShellComponent, never>;
1560
+ static ɵcmp: i0.ɵɵComponentDeclaration<PraxisAiAssistantShellComponent, "praxis-ai-assistant-shell", never, { "labels": { "alias": "labels"; "required": false; }; "mode": { "alias": "mode"; "required": false; }; "state": { "alias": "state"; "required": false; }; "contextItems": { "alias": "contextItems"; "required": false; }; "attachments": { "alias": "attachments"; "required": false; }; "messages": { "alias": "messages"; "required": false; }; "quickReplies": { "alias": "quickReplies"; "required": false; }; "prompt": { "alias": "prompt"; "required": false; }; "statusText": { "alias": "statusText"; "required": false; }; "errorText": { "alias": "errorText"; "required": false; }; "testIdPrefix": { "alias": "testIdPrefix"; "required": false; }; "panelTestId": { "alias": "panelTestId"; "required": false; }; "submitTestId": { "alias": "submitTestId"; "required": false; }; "applyTestId": { "alias": "applyTestId"; "required": false; }; "busy": { "alias": "busy"; "required": false; }; "canSubmit": { "alias": "canSubmit"; "required": false; }; "canApply": { "alias": "canApply"; "required": false; }; "submitOnEnter": { "alias": "submitOnEnter"; "required": false; }; "enableFileAttachments": { "alias": "enableFileAttachments"; "required": false; }; "attachmentAccept": { "alias": "attachmentAccept"; "required": false; }; "attachmentMultiple": { "alias": "attachmentMultiple"; "required": false; }; "draggable": { "alias": "draggable"; "required": false; }; "resizable": { "alias": "resizable"; "required": false; }; "minWidth": { "alias": "minWidth"; "required": false; }; "minHeight": { "alias": "minHeight"; "required": false; }; "margin": { "alias": "margin"; "required": false; }; "layout": { "alias": "layout"; "required": false; }; }, { "promptChange": "promptChange"; "submitPrompt": "submitPrompt"; "apply": "apply"; "close": "close"; "attach": "attach"; "attachmentsPasted": "attachmentsPasted"; "attachmentsSelected": "attachmentsSelected"; "removeAttachment": "removeAttachment"; "messageAction": "messageAction"; "editMessage": "editMessage"; "resendMessage": "resendMessage"; "quickReply": "quickReply"; "layoutChange": "layoutChange"; }, never, never, true, never>;
1068
1561
  }
1069
1562
 
1070
1563
  declare class AiContextBuilderService {
@@ -1138,5 +1631,5 @@ declare class AiRuleWizardDialogComponent implements OnInit {
1138
1631
  static ɵcmp: i0.ɵɵComponentDeclaration<AiRuleWizardDialogComponent, "praxis-ai-rule-wizard-dialog", never, {}, {}, never, never, true, never>;
1139
1632
  }
1140
1633
 
1141
- export { AI_INTENT_CONTRACT_SCHEMA_HASH, AI_INTENT_CONTRACT_VERSION, AiBackendApiService, AiPatchStreamConnectionError, AiResponseValidatorService, AiRuleWizardDialogComponent, BaseAiAdapter, PraxisAi, PraxisAiAssistantComponent, SchemaMinifierService };
1142
- export type { AiChatMessage, AiConfigAdapter, AiContextDTO, AiContextTemplate, AiContextTemplateMeta, AiCurrentStateDigest, AiExamplePair, AiGlobalConfigSnapshot, AiHeaderContext, AiIntegrationConfig, AiModel, AiOrchestratorRequest, AiOrchestratorResponse, AiPatchDiff, AiPatchStreamCancelResponse, AiPatchStreamConnection, AiPatchStreamConnectionErrorKind, AiPatchStreamEnvelope, AiPatchStreamEventType, AiPatchStreamStartResponse, AiProviderCatalogItem, AiProviderCatalogResponse, AiProviderModelsRequest, AiProviderModelsResponse, AiProviderStatusResponse, AiProviderTestRequest, AiProviderTestResponse, AiRuleResponse, AiSchemaContext, AiSuggestion, AiSuggestionsRequest, AiSuggestionsResponse, AiUiContextRef, AiValidationError, AiValidationResult, AiValidationWarning, AiWizardData, Capability, FieldSchemaLike, MinifiedField, PatchResult, PromptContext, RulePropertyDefinition, RulePropertySchema, RulePropertyType, ValidationContext, ValueKind };
1634
+ export { AI_BACKEND_CONFIG_STORE, AI_BACKEND_STORAGE_OPTIONS, AI_CONTRACT_SCHEMA_HASH, AI_CONTRACT_VERSION, AI_INTENT_CONTRACT_SCHEMA_HASH, AI_INTENT_CONTRACT_VERSION, AI_STREAM_EVENT_SCHEMA_VERSION, AI_STREAM_EVENT_TYPES, AiBackendApiService, AiPatchStreamConnectionError, AiResponseValidatorService, AiRuleWizardDialogComponent, BaseAiAdapter, PraxisAi, PraxisAiAssistantComponent, PraxisAiAssistantShellComponent, PraxisAiService, PraxisAssistantTurnController, PraxisAssistantTurnOrchestratorService, SchemaMinifierService };
1635
+ export type { AgenticAuthoringApplyRequestContract, AgenticAuthoringApplyResultContract, AgenticAuthoringAttachmentSummaryContract, AgenticAuthoringCandidateContract, AgenticAuthoringComponentCapabilitiesResultContract, AgenticAuthoringConversationContextContract, AgenticAuthoringConversationMessageContract, AgenticAuthoringIntentResolutionRequestContract, AgenticAuthoringIntentResolutionResultContract, AgenticAuthoringPendingClarificationContract, AgenticAuthoringPlanRequestContract, AgenticAuthoringPreviewResultContract, AgenticAuthoringQuickReplyContract, AiBackendConfigStore, AiBackendStorageOptions, AiChatMessage, AiChatMessageContract, AiClarificationUiContract, AiConfigAdapter, AiContextDTO, AiContextTemplate, AiContextTemplateMeta, AiCurrentStateDigest, AiCurrentStateDigestContract, AiExamplePair, AiGlobalConfigSnapshot, AiHeaderContext, AiIntegrationConfig, AiJsonArray, AiJsonObject, AiJsonPrimitive, AiJsonValue, AiMemoryInfoContract, AiModel, AiOptionContract, AiOrchestratorRequest, AiOrchestratorRequestContract, AiOrchestratorResponse, AiOrchestratorResponseContract, AiOrchestratorResponseType, AiPatchDiff, AiPatchDiffContract, AiPatchStreamCancelResponse, AiPatchStreamCancelResponseContract, AiPatchStreamConnection, AiPatchStreamConnectionErrorKind, AiPatchStreamEnvelope, AiPatchStreamEnvelopeContract, AiPatchStreamEventType, AiPatchStreamStartResponse, AiPatchStreamStartResponseContract, AiProviderCatalogItem, AiProviderCatalogResponse, AiProviderModelsRequest, AiProviderModelsResponse, AiProviderStatusResponse, AiProviderTestRequest, AiProviderTestResponse, AiResponseCompileResult, AiRuleResponse, AiSchemaContext, AiSchemaContextContract, AiSuggestion, AiSuggestionsRequest, AiSuggestionsResponse, AiUiContextRef, AiUiContextRefContract, AiValidationError, AiValidationResult, AiValidationWarning, AiWizardData, Capability, FieldSchemaLike, MinifiedField, PatchResult, PraxisAssistantClarificationOption, PraxisAssistantClarificationQuestion, PraxisAssistantClarificationQuestionType, PraxisAssistantPendingClarification, PraxisAssistantShellAttachment, PraxisAssistantShellContextItem, PraxisAssistantShellLabels, PraxisAssistantShellLayout, PraxisAssistantShellMessage, PraxisAssistantShellMessageAction, PraxisAssistantShellMessageRole, PraxisAssistantShellMode, PraxisAssistantShellQuickReply, PraxisAssistantShellState, PraxisAssistantTurnAction, PraxisAssistantTurnControllerOptions, PraxisAssistantTurnFlow, PraxisAssistantTurnPhase, PraxisAssistantTurnRequest, PraxisAssistantTurnResult, PraxisAssistantTurnViewState, ProblemResponseContract, PromptContext, RulePropertyDefinition, RulePropertySchema, RulePropertyType, ValidationContext, ValueKind };