import { Signal } from '@angular/core'; import { IEntityToken } from './enum-interfaces/entity-token'; import { IOmegaDecision } from './enum-interfaces/omega-decision'; import { AnyIntentDescriptor, IIntentInputError, IIntentInputValidatorSchema } from './enum-interfaces/intent-descriptor.model'; import { IOmegaProjectionVm } from './enum-interfaces/omega-projection.vm'; import { FormBuilder, FormGroup, ValidatorFn } from '@angular/forms'; import { Subscription } from 'rxjs'; import { IntentInputMode } from './enum-interfaces/intent-input-mode'; import { AppConfigService } from '../../services/app-config.service'; import { IIntentNarrationContext } from './enum-interfaces/narration-engine'; import { IOmegaIntent } from './enum-interfaces/omega-intent'; import { AnyIntentDraft } from './enum-interfaces/intent-draft.model'; import { CoreFormService } from '../core-form/core-form.service'; import * as i0 from "@angular/core"; export declare class DomDecisionContextService { fb: FormBuilder; $form: import("@angular/core").WritableSignal>; formSubscription: Subscription; $errors: import("@angular/core").WritableSignal; acs: AppConfigService; coreFormService: CoreFormService; $formRawValue: import("@angular/core").WritableSignal; $omega: import("@angular/core").WritableSignal; $draftChain: import("@angular/core").WritableSignal; $loading: import("@angular/core").WritableSignal; intentSummaries: WeakMap; clearAllState(): void; getIntentSummary(intent: AnyIntentDraft): string; getIntentSummaryBySeq(seq: number): string; updateSummaries(): void; private buildTemporalPart; private buildIntentSummary; $selectedIntentDescriptor: import("@angular/core").WritableSignal; /** * chỉ dùng cho CREATE */ $createSeq: Signal; /** * dùng cho VIEW / EDIT LATEST */ $viewSeq: import("@angular/core").WritableSignal; $projection: Signal; $activeInputSnapshot: Signal> | null>; $nextSeq: Signal; $isLastSeq: Signal; /** * $allTokens * ---------------------------------------- * Tập hợp TẤT CẢ các EntityToken đã từng được sinh ra * trong toàn bộ vòng đời của omega (inputChain). * * Đặc điểm: * - Không lọc theo seq * - Không deduplicate theo uuid * - Không suy diễn trạng thái hiện tại * - Không áp dụng bất kỳ quy tắc nghiệp vụ nào * * Mục đích: * - Debug trực quan lịch sử sinh token * - Quan sát các token trùng uuid qua nhiều bước * - Kiểm chứng producedBySeq, humanSnapshot, token id * * ⚠️ Lưu ý quan trọng: * $allTokens KHÔNG nên được dùng trực tiếp cho nghiệp vụ * hay binding UI chính thức. * Đây là "sự thật thô" (raw artifact stream), * phục vụ quan sát và kiểm chứng engine. */ $allTokens: Signal; /** * $currentTokens * ---------------------------------------- * Tập hợp các EntityToken HỢP LỆ tại thời điểm quyết định hiện tại, * được suy diễn dựa trên: * - $allTokens * - seq (bối cảnh đang xét) * * Nguyên tắc: * - Chỉ xét token có producedBySeq <= seq * - Với mỗi uuid, chỉ giữ token mới nhất (last-write-wins theo seq) * * Ý nghĩa nghiệp vụ: * - Đại diện cho "ảnh chụp trạng thái" của các entity * tại một thời điểm trong chuỗi quyết định * - Phục vụ UI picker, dependency resolution, intent composition * * Khác với $allTokens: * - $allTokens = lịch sử đầy đủ (audit / replay) * - $currentTokens = trạng thái hiện hành (decision context) * * Đây là signal CHÍNH THỨC để UI và engine sử dụng * khi cần suy luận hoặc cho phép người dùng chọn entity. */ $currentTokens: Signal; /** * Build và bind lại form theo trạng thái hiện tại của decision. * * - Không giữ draft field-level * - Luôn render từ omega (working store) * - Được gọi lại khi descriptor / seq / omega thay đổi * * @param descriptor Mô tả intent đang được edit */ buildForm(descriptor: AnyIntentDescriptor): void; buildValidators(schema?: IIntentInputValidatorSchema): ValidatorFn[]; private bindFormValueChanges; intentInputMode(): IntentInputMode; buildTemporalContext(facts: Record): IIntentNarrationContext['temporal']; private normalizeUtc; private formatLocalDate; buildNarrationContext(intent: IOmegaIntent): IIntentNarrationContext; /** * Xây dựng Resolved Context cho Intent Narration * * Lớp này làm nhiệm vụ làm giàu (enrich) dữ liệu intent thô * bằng các giá trị dễ đọc, phục vụ cho việc diễn giải (narration), * nhưng TUYỆT ĐỐI KHÔNG thay đổi hay ghi đè lên facts gốc. * * Nguyên tắc thiết kế: * - facts : sự thật máy móc, bất biến (ID, mã, UTC, enum…) * - resolved : diễn giải bổ sung, tùy chọn, thân thiện với con người * - grammar : chỉ ghép câu, không tra cứu, không chứa logic nghiệp vụ * * Trách nhiệm của hàm này: * - Diễn giải các tham chiếu chéo (ví dụ: TREE_ID → TREE_NAME) * - Chuẩn hóa vai trò thành nhãn dễ đọc (ví dụ: MASTER → "vai trò chính") * - Lưu giữ snapshot tên hiển thị tại thời điểm tạo intent * (LEFT_/RIGHT_ ORIGINAL_NAME) phục vụ audit và narration * * Những gì hàm này KHÔNG làm (có chủ ý): * - Không gọi API / DB tại runtime * - Không thay đổi dữ liệu facts đầu vào * - Không xử lý logic ngữ pháp hay ghép câu * * Đây là lớp "diễn giải ngữ nghĩa" nằm giữa dữ liệu intent thuần * và lớp grammar chịu trách nhiệm kể câu chuyện cho con người. */ buildResolvedContext(facts: Record): Record; rebuildProjectionFromOmega(omega: IOmegaDecision): IOmegaProjectionVm; produceOutputs(seq: number, draft: AnyIntentDraft): IEntityToken[] | undefined; getErrorsOfField(fieldKey: string): IIntentInputError[]; rebuildErrors(descriptor: AnyIntentDescriptor): void; private buildFallbackErrorMessage; private getRaw; private getWys; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; }