ngx-t-forms 3.1.3 → 3.1.5
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/{ngx-t-forms-api-endpoint-config.component-BAWiavFB.mjs → ngx-t-forms-api-endpoint-config.component-DLg5vzNJ.mjs} +6 -6
- package/fesm2022/{ngx-t-forms-api-endpoint-config.component-BAWiavFB.mjs.map → ngx-t-forms-api-endpoint-config.component-DLg5vzNJ.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-auto-complete-input-element.component-Cph2QuN3.mjs → ngx-t-forms-auto-complete-input-element.component-CQ9gB964.mjs} +28 -11
- package/fesm2022/ngx-t-forms-auto-complete-input-element.component-CQ9gB964.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-basic-input-input-element.component-o6l7xW3J.mjs → ngx-t-forms-basic-input-input-element.component-B-J4qO_Z.mjs} +3 -3
- package/fesm2022/{ngx-t-forms-basic-input-input-element.component-o6l7xW3J.mjs.map → ngx-t-forms-basic-input-input-element.component-B-J4qO_Z.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-calculated-field-rules.component-CZ5c7fRi.mjs → ngx-t-forms-calculated-field-rules.component-KHUBx8wM.mjs} +2 -42
- package/fesm2022/ngx-t-forms-calculated-field-rules.component-KHUBx8wM.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-chip-options-creator-editor.component-aNd2SXIA.mjs → ngx-t-forms-chip-options-creator-editor.component-DAZVCoUZ.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-chip-options-creator-editor.component-aNd2SXIA.mjs.map → ngx-t-forms-chip-options-creator-editor.component-DAZVCoUZ.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-conditional-display-config.component-yJ5IORsS.mjs → ngx-t-forms-conditional-display-config.component-p3dEGx1z.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-conditional-display-config.component-yJ5IORsS.mjs.map → ngx-t-forms-conditional-display-config.component-p3dEGx1z.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-config-mscoa-additional-inputs.component-B2U7LSRf.mjs → ngx-t-forms-config-mscoa-additional-inputs.component-CAk0k2YC.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-config-mscoa-additional-inputs.component-B2U7LSRf.mjs.map → ngx-t-forms-config-mscoa-additional-inputs.component-CAk0k2YC.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-data-source-picker.component-Bd1wm12Q.mjs → ngx-t-forms-data-source-picker.component-CUVjocuE.mjs} +6 -6
- package/fesm2022/{ngx-t-forms-data-source-picker.component-Bd1wm12Q.mjs.map → ngx-t-forms-data-source-picker.component-CUVjocuE.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-date-picker-input-element.component-BduBmu9K.mjs → ngx-t-forms-date-picker-input-element.component-lQfvlGfA.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-date-picker-input-element.component-BduBmu9K.mjs.map → ngx-t-forms-date-picker-input-element.component-lQfvlGfA.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-date-range-picker-input-element.component-CATduVDL.mjs → ngx-t-forms-date-range-picker-input-element.component-7t9Ib-35.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-date-range-picker-input-element.component-CATduVDL.mjs.map → ngx-t-forms-date-range-picker-input-element.component-7t9Ib-35.mjs.map} +1 -1
- package/fesm2022/ngx-t-forms-date-time-picker-input-element.component-Co0nzt6l.mjs +232 -0
- package/fesm2022/ngx-t-forms-date-time-picker-input-element.component-Co0nzt6l.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-document-list-label-config-editor.component-BU0QJYNH.mjs → ngx-t-forms-document-list-label-config-editor.component-xQuX0E3x.mjs} +3 -3
- package/fesm2022/{ngx-t-forms-document-list-label-config-editor.component-BU0QJYNH.mjs.map → ngx-t-forms-document-list-label-config-editor.component-xQuX0E3x.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-document-picker.component-3mqXc4s6.mjs → ngx-t-forms-document-picker.component-umv9Z3rU.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-document-picker.component-3mqXc4s6.mjs.map → ngx-t-forms-document-picker.component-umv9Z3rU.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-editor-input-element.component-D_SjJtw9.mjs → ngx-t-forms-editor-input-element.component-BHq-LOhI.mjs} +3 -3
- package/fesm2022/{ngx-t-forms-editor-input-element.component-D_SjJtw9.mjs.map → ngx-t-forms-editor-input-element.component-BHq-LOhI.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-file-upload-input-element.component-DZuAYjpr.mjs → ngx-t-forms-file-upload-input-element.component-DjVntIfw.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-file-upload-input-element.component-DZuAYjpr.mjs.map → ngx-t-forms-file-upload-input-element.component-DjVntIfw.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-form-input-selector.component-B6FoYGy5.mjs → ngx-t-forms-form-input-selector.component-DX85MMcQ.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-form-input-selector.component-B6FoYGy5.mjs.map → ngx-t-forms-form-input-selector.component-DX85MMcQ.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-form-json-view.component-DsEizrc-.mjs → ngx-t-forms-form-json-view.component-f6QyPY6E.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-form-json-view.component-DsEizrc-.mjs.map → ngx-t-forms-form-json-view.component-f6QyPY6E.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-form-section-stepper.component-ZJDWyxa7.mjs → ngx-t-forms-form-section-stepper.component-ChaSUCrg.mjs} +4 -4
- package/fesm2022/{ngx-t-forms-form-section-stepper.component-ZJDWyxa7.mjs.map → ngx-t-forms-form-section-stepper.component-ChaSUCrg.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-forms-builder-menu.component-oVpP2Jgt.mjs → ngx-t-forms-forms-builder-menu.component-Qkw23Bzy.mjs} +4 -4
- package/fesm2022/{ngx-t-forms-forms-builder-menu.component-oVpP2Jgt.mjs.map → ngx-t-forms-forms-builder-menu.component-Qkw23Bzy.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-geo-location.component-Cml0Do4m.mjs → ngx-t-forms-geo-location.component-DqYEmeLs.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-geo-location.component-Cml0Do4m.mjs.map → ngx-t-forms-geo-location.component-DqYEmeLs.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-header-template-editor.component-NRiXTnwH.mjs → ngx-t-forms-header-template-editor.component-CIft152I.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-header-template-editor.component-NRiXTnwH.mjs.map → ngx-t-forms-header-template-editor.component-CIft152I.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-image-capture-input-element.component-IFval472.mjs → ngx-t-forms-image-capture-input-element.component-BmVXoC_z.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-image-capture-input-element.component-IFval472.mjs.map → ngx-t-forms-image-capture-input-element.component-BmVXoC_z.mjs.map} +1 -1
- package/fesm2022/ngx-t-forms-index-yasuBvXP.mjs +2 -0
- package/fesm2022/ngx-t-forms-index-yasuBvXP.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-input-custom.component-CTye_tsv.mjs +309 -0
- package/fesm2022/ngx-t-forms-input-custom.component-CTye_tsv.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-input-editor.component-zL4cp2gq.mjs → ngx-t-forms-input-editor.component-DbhnFkYQ.mjs} +3 -3
- package/fesm2022/{ngx-t-forms-input-editor.component-zL4cp2gq.mjs.map → ngx-t-forms-input-editor.component-DbhnFkYQ.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-map-mat-options-keys-0tNskyLE.mjs → ngx-t-forms-map-mat-options-keys-B49fcbzx.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-map-mat-options-keys-0tNskyLE.mjs.map → ngx-t-forms-map-mat-options-keys-B49fcbzx.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-mat-chip-list-editor.component-CGMhUIuc.mjs → ngx-t-forms-mat-chip-list-editor.component-C0iLh1ON.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-mat-chip-list-editor.component-CGMhUIuc.mjs.map → ngx-t-forms-mat-chip-list-editor.component-C0iLh1ON.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-missing-form-configs.component-BXiXHKG_.mjs → ngx-t-forms-missing-form-configs.component-BsX7Ezy-.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-missing-form-configs.component-BXiXHKG_.mjs.map → ngx-t-forms-missing-form-configs.component-BsX7Ezy-.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-mscoa-chart-toolbar.component-BVtVrTn1.mjs → ngx-t-forms-mscoa-chart-toolbar.component-D8GL9Aht.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-mscoa-chart-toolbar.component-BVtVrTn1.mjs.map → ngx-t-forms-mscoa-chart-toolbar.component-D8GL9Aht.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-mscoa-config.component-CmIR92zj.mjs → ngx-t-forms-mscoa-config.component-Sz8VZ-vc.mjs} +61 -12
- package/fesm2022/ngx-t-forms-mscoa-config.component-Sz8VZ-vc.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-mscoa-segment-config.component-CVTRW43v.mjs → ngx-t-forms-mscoa-segment-config.component-COepe5G2.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-mscoa-segment-config.component-CVTRW43v.mjs.map → ngx-t-forms-mscoa-segment-config.component-COepe5G2.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-multiple-input-input-element.component-CUgTJJRW.mjs → ngx-t-forms-multiple-input-input-element.component-DlgTjJpj.mjs} +4 -4
- package/fesm2022/{ngx-t-forms-multiple-input-input-element.component-CUgTJJRW.mjs.map → ngx-t-forms-multiple-input-input-element.component-DlgTjJpj.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-ngx-t-forms-BA1CoCl_.mjs → ngx-t-forms-ngx-t-forms-B3WhBGlD.mjs} +10021 -99
- package/fesm2022/ngx-t-forms-ngx-t-forms-B3WhBGlD.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-paginated-selection-table-CdEJa3FZ.mjs → ngx-t-forms-paginated-selection-table-CILBCL4K.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-paginated-selection-table-CdEJa3FZ.mjs.map → ngx-t-forms-paginated-selection-table-CILBCL4K.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-payload-template-editor.component-CZoqYRKK.mjs → ngx-t-forms-payload-template-editor.component-C8OasgK7.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-payload-template-editor.component-CZoqYRKK.mjs.map → ngx-t-forms-payload-template-editor.component-C8OasgK7.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-pipeline-generator.component-LbAmKWNG.mjs → ngx-t-forms-pipeline-generator.component-_yowsgF6.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-pipeline-generator.component-LbAmKWNG.mjs.map → ngx-t-forms-pipeline-generator.component-_yowsgF6.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-quill-input.component-CKYNVDDV.mjs → ngx-t-forms-quill-input.component-BWq5cLY-.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-quill-input.component-CKYNVDDV.mjs.map → ngx-t-forms-quill-input.component-BWq5cLY-.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-record-list-manager.component-BNdEvWsZ.mjs → ngx-t-forms-record-list-manager.component-C-lAzlO-.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-record-list-manager.component-BNdEvWsZ.mjs.map → ngx-t-forms-record-list-manager.component-C-lAzlO-.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-required-inputs.component-D_cQIScV.mjs → ngx-t-forms-required-inputs.component-8cQr2QWm.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-required-inputs.component-D_cQIScV.mjs.map → ngx-t-forms-required-inputs.component-8cQr2QWm.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-rest-api-call-setup.component-BhQmOVHN.mjs → ngx-t-forms-rest-api-call-setup.component-Bhj9jcQk.mjs} +197 -175
- package/fesm2022/ngx-t-forms-rest-api-call-setup.component-Bhj9jcQk.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-section-report.component-m2Z6qA3j.mjs → ngx-t-forms-section-report.component-CWCqrc7k.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-section-report.component-m2Z6qA3j.mjs.map → ngx-t-forms-section-report.component-CWCqrc7k.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-select-input-element.component-DH5knOzd.mjs → ngx-t-forms-select-input-element.component-BGD67Dnh.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-select-input-element.component-DH5knOzd.mjs.map → ngx-t-forms-select-input-element.component-BGD67Dnh.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-selection-options-editor.component-UBt2kiPk.mjs → ngx-t-forms-selection-options-editor.component-ClXaOeXt.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-selection-options-editor.component-UBt2kiPk.mjs.map → ngx-t-forms-selection-options-editor.component-ClXaOeXt.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-textarea-input-element.component-B9JLzhTh.mjs → ngx-t-forms-textarea-input-element.component-Z-wkFzgQ.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-textarea-input-element.component-B9JLzhTh.mjs.map → ngx-t-forms-textarea-input-element.component-Z-wkFzgQ.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-toggle-input-element.component-B9_03RoG.mjs → ngx-t-forms-toggle-input-element.component-CvR3-IjP.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-toggle-input-element.component-B9_03RoG.mjs.map → ngx-t-forms-toggle-input-element.component-CvR3-IjP.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-token-text-input.component-BQADsnFn.mjs → ngx-t-forms-token-text-input.component-vnOkP_CV.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-token-text-input.component-BQADsnFn.mjs.map → ngx-t-forms-token-text-input.component-vnOkP_CV.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-validators-config.component-qO6Y4x1v.mjs → ngx-t-forms-validators-config.component-DhuB7c63.mjs} +2 -2
- package/fesm2022/{ngx-t-forms-validators-config.component-qO6Y4x1v.mjs.map → ngx-t-forms-validators-config.component-DhuB7c63.mjs.map} +1 -1
- package/fesm2022/{ngx-t-forms-workflow-adjudication.component-SUbSx79R.mjs → ngx-t-forms-workflow-adjudication.component-Dc4r01D7.mjs} +3 -3
- package/fesm2022/{ngx-t-forms-workflow-adjudication.component-SUbSx79R.mjs.map → ngx-t-forms-workflow-adjudication.component-Dc4r01D7.mjs.map} +1 -1
- package/fesm2022/ngx-t-forms.mjs +1 -1
- package/package.json +3 -3
- package/types/ngx-t-forms.d.ts +1754 -5
- package/fesm2022/ngx-t-forms-auto-complete-input-element.component-Cph2QuN3.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-calculated-field-rules.component-CZ5c7fRi.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-index-Cl4VG3Vd.mjs +0 -2
- package/fesm2022/ngx-t-forms-index-Cl4VG3Vd.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-input-custom.component-q8jPq7KI.mjs +0 -105
- package/fesm2022/ngx-t-forms-input-custom.component-q8jPq7KI.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mscoa-config.component-CmIR92zj.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-ngx-t-forms-BA1CoCl_.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-rest-api-call-setup.component-BhQmOVHN.mjs.map +0 -1
package/types/ngx-t-forms.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
2
|
import { Provider, EnvironmentProviders, InjectionToken, Signal, OnInit, OnDestroy, PipeTransform, Type, ElementRef } from '@angular/core';
|
|
3
3
|
import * as ngx_t_forms_types from 'ngx-t-forms-types';
|
|
4
|
-
import { NgxTFormsConfig,
|
|
4
|
+
import { NgxTFormsConfig, ElementTypes, FormInterface, APIDataFetchingConfigurationInterface, IFormActions, FormSlideInterface, InClassFormUtilsInterface, IWorkflowDocumentPicker, IBasicFormInput, IFileUploadInput, IDateRangePickerInput, ITextareaProperties, IToggleInput, IMatrixInput, IMultiple, IGetTreeResponse, IRunPipelineResponse, IPipelineGenerationResponse, InputDataTypes, FormInputBasicOptionInterface, LocalFormStateSelectorInterface, FormsStoreSelectorsInterface, FormListSection, ITowerFormSteps, WorkflowFunctionTypes, FileData, FormSubmissionStatus, IFormValidationOverride, FormColumnInputs, IFormChangeHistory, IStepOption, FormBuilderFunctions, ElementEditorTypes, ElementEditorInnerSectionElementInterface, ITowerStepColumn, ScoaInnerInput, IWorkflowOption, BlurHandleTypes, TreeNode, FlatNode, IArrayFunction, DocumentLitsLabelConfigInterfaceValueType, InputPipeTypes, EncryptedData, ImportProgress, ImportRowState, ValidationError, DialogConfig, PropertyPath, DeepPropertyValue, FileUploadInputValueInterface, FormInterfaceMigration, ConfigurationValidTestInterface } from 'ngx-t-forms-types';
|
|
5
5
|
export { BlurHandleTypes, ConfigurationValidTestInterface, DeepPropertyValue, DialogConfig, DocumentLitsLabelConfigInterfaceValueType, ElementEditorInnerSectionElementInterface, ElementEditorTypes, EncryptedData, FileUploadInputValueInterface, FormBuilderFunctions, FormColumnInputs, FormInputBasicOptionInterface, FormInterface, FormInterfaceMigration, FormListSection, FormSubmissionStatus, IArrayFunction, IFormActions, IFormChangeHistory, IFormTour, IFormValidationOverride, IGetTreeResponse, IScoaAccount, ITowerStepColumn, IWorkflowOption, ImportProgress, ImportRowState, ImportRowStatus, InClassFormUtilsInterface, InputDataTypes, InputPipeTypes, LocalFormStateSelectorInterface, NgxTFormsConfig, OLD_FormInterface, PropertyPath, TreeNode, ValidationError, WorkflowFunctionTypes } from 'ngx-t-forms-types';
|
|
6
6
|
import * as rxjs from 'rxjs';
|
|
7
7
|
import { Observable, Subject } from 'rxjs';
|
|
8
8
|
import { PipelineStage } from 'mongoose';
|
|
9
9
|
import { s } from '@hashbrownai/core';
|
|
10
|
+
import { AvailableApiEndpoint } from 'ngx-t-forms-types/skillet';
|
|
10
11
|
import { Router, ActivatedRoute } from '@angular/router';
|
|
11
12
|
import { MatStepper } from '@angular/material/stepper';
|
|
12
13
|
import { StepperSelectionEvent, StepState } from '@angular/cdk/stepper';
|
|
@@ -26,7 +27,10 @@ declare const enum NgxTFormsFeatureKind {
|
|
|
26
27
|
HttpPipeline = 3,
|
|
27
28
|
InputSecret = 4,
|
|
28
29
|
RouterFormId = 5,
|
|
29
|
-
FormSuggestions = 6
|
|
30
|
+
FormSuggestions = 6,
|
|
31
|
+
AiFormBuilder = 7,
|
|
32
|
+
AiEndpointCatalog = 8,
|
|
33
|
+
AiMscoaGrounding = 9
|
|
30
34
|
}
|
|
31
35
|
interface NgxTFormsFeature {
|
|
32
36
|
readonly kind: NgxTFormsFeatureKind;
|
|
@@ -125,6 +129,1067 @@ declare function withRouterFormId(): NgxTFormsFeature;
|
|
|
125
129
|
*/
|
|
126
130
|
declare function withFormSuggestions(): NgxTFormsFeature;
|
|
127
131
|
|
|
132
|
+
/**
|
|
133
|
+
* @file Domain models for the AI form-builder drafting pipeline.
|
|
134
|
+
*
|
|
135
|
+
* Inner-ring module: its only import is a **type-only** one from
|
|
136
|
+
* `ngx-t-forms-types`, erased at compile time. No runtime Angular concretions,
|
|
137
|
+
* no library internals, no `@hashbrownai/*`.
|
|
138
|
+
* Mirrors the constraint documented on `domain/form-suggestion.model.ts`.
|
|
139
|
+
*
|
|
140
|
+
* These types describe **pipeline artifacts** (the conversation, the plan, the
|
|
141
|
+
* session, the findings). They deliberately do *not* describe the form model:
|
|
142
|
+
* `ngx-t-forms-types/skillet` is the single generation contract for that, and
|
|
143
|
+
* this library never re-derives or forks it (AI_FORM_BUILDER_DESIGN.md §7).
|
|
144
|
+
*/
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* A specialised role in the drafting pipeline.
|
|
148
|
+
*
|
|
149
|
+
* Phase 1 exercises `analyst`, `architect` and `generator`; the remaining roles
|
|
150
|
+
* are reserved so that per-role model overrides written today keep working when
|
|
151
|
+
* the grounded specialists and the critic land in Phases 2–3.
|
|
152
|
+
*/
|
|
153
|
+
type AiFormBuilderRole = 'analyst' | 'architect' | 'generator' | 'dataSource' | 'mscoa' | 'logic' | 'critic';
|
|
154
|
+
/**
|
|
155
|
+
* Lifecycle stage of a {@link DraftSession}.
|
|
156
|
+
*
|
|
157
|
+
* The pipeline advances strictly forward except for its two loops: `repairing`
|
|
158
|
+
* is re-entered from `verifying` while the repair budget lasts, and
|
|
159
|
+
* `critiquing` returns to `planning` for each critique revision round.
|
|
160
|
+
*/
|
|
161
|
+
type DraftStage =
|
|
162
|
+
/** No draft in progress. */
|
|
163
|
+
'idle'
|
|
164
|
+
/** Conversational intake with the Analyst. */
|
|
165
|
+
| 'intake'
|
|
166
|
+
/** The Architect is planning slides and field stubs. */
|
|
167
|
+
| 'planning'
|
|
168
|
+
/** The Field Generator is producing columns. */
|
|
169
|
+
| 'generating'
|
|
170
|
+
/** Deterministic assembly and draft expansion. */
|
|
171
|
+
| 'assembling'
|
|
172
|
+
/** Deterministic verification (Joi + reference integrity). */
|
|
173
|
+
| 'verifying'
|
|
174
|
+
/** A routed repair turn is in flight. */
|
|
175
|
+
| 'repairing'
|
|
176
|
+
/**
|
|
177
|
+
* The Critic is reviewing a form that has already cleared every
|
|
178
|
+
* deterministic gate.
|
|
179
|
+
*
|
|
180
|
+
* **Added after this union first shipped**, and therefore a widening a
|
|
181
|
+
* consumer may have to answer for: an exhaustive `switch` or a
|
|
182
|
+
* `Record<DraftStage, T>` written against the narrower union stops
|
|
183
|
+
* compiling until this member is handled. That cost was accepted
|
|
184
|
+
* deliberately. The Critic previously ran under `planning`, so a host had no
|
|
185
|
+
* way to tell a reviewer's turn from a planner's and could only show
|
|
186
|
+
* "planning" while nothing was being planned — and a stage that misreports
|
|
187
|
+
* what the pipeline is doing is worse than a compile error the consumer can
|
|
188
|
+
* see and fix in one place.
|
|
189
|
+
*
|
|
190
|
+
* Covers the Critic's own turn and nothing else. The revision that a
|
|
191
|
+
* blocking critique triggers is a re-plan by the Architect, so the session
|
|
192
|
+
* goes back to `planning` for it.
|
|
193
|
+
*/
|
|
194
|
+
| 'critiquing'
|
|
195
|
+
/** A valid form is staged and awaiting human review. */
|
|
196
|
+
| 'staged'
|
|
197
|
+
/** The pipeline stopped without producing a staged form. */
|
|
198
|
+
| 'failed';
|
|
199
|
+
/** Author of a message in the intake conversation. */
|
|
200
|
+
type DraftMessageAuthor = 'user' | 'assistant';
|
|
201
|
+
/** One turn of the conversational intake with the Analyst. */
|
|
202
|
+
interface DraftMessage {
|
|
203
|
+
/** Who produced this turn. */
|
|
204
|
+
readonly author: DraftMessageAuthor;
|
|
205
|
+
/** Plain-text content of the turn. */
|
|
206
|
+
readonly content: string;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* One numbered business rule captured by the Analyst.
|
|
210
|
+
*
|
|
211
|
+
* The ledger of rules doubles as the Critic's coverage checklist in Phase 3, so
|
|
212
|
+
* ids must be stable and unique within a {@link FormBrief}.
|
|
213
|
+
*/
|
|
214
|
+
interface FormBriefRule {
|
|
215
|
+
/** Stable identifier, unique within the brief (e.g. `R1`). */
|
|
216
|
+
readonly id: string;
|
|
217
|
+
/** The rule as stated, in the user's own terms. */
|
|
218
|
+
readonly statement: string;
|
|
219
|
+
}
|
|
220
|
+
/** A field the Analyst inferred from the brief, before any layout decision. */
|
|
221
|
+
interface FormBriefField {
|
|
222
|
+
/** Human-readable name of the field. */
|
|
223
|
+
readonly name: string;
|
|
224
|
+
/** What the field is for, in one sentence. */
|
|
225
|
+
readonly purpose: string;
|
|
226
|
+
/** Whether the user must supply a value. */
|
|
227
|
+
readonly required: boolean;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Structured intake produced by the Analyst — the conversational front door of
|
|
231
|
+
* the pipeline and the input to the Architect.
|
|
232
|
+
*/
|
|
233
|
+
interface FormBrief {
|
|
234
|
+
/** Proposed title for the form. */
|
|
235
|
+
readonly formTitle: string;
|
|
236
|
+
/** One-paragraph statement of what the form is for. */
|
|
237
|
+
readonly summary: string;
|
|
238
|
+
/** Field intents, before slides or element types are chosen. */
|
|
239
|
+
readonly fields: readonly FormBriefField[];
|
|
240
|
+
/** Numbered business-rules ledger. */
|
|
241
|
+
readonly rules: readonly FormBriefRule[];
|
|
242
|
+
/** Questions the Analyst wants the user to answer. */
|
|
243
|
+
readonly openQuestions: readonly string[];
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* A planned field stub. The Architect chooses the element and data type; the
|
|
247
|
+
* Field Generator later expands the stub into a full form column.
|
|
248
|
+
*/
|
|
249
|
+
interface BlueprintField {
|
|
250
|
+
/** Control name the generated column will carry. */
|
|
251
|
+
readonly formControlName: string;
|
|
252
|
+
/** Visible label. */
|
|
253
|
+
readonly label: string;
|
|
254
|
+
/** Element type to generate. Constrained to the configured element union. */
|
|
255
|
+
readonly element: ElementTypes;
|
|
256
|
+
/** Whether the user must supply a value. */
|
|
257
|
+
readonly required: boolean;
|
|
258
|
+
/** Ids of the {@link FormBriefRule}s this field is meant to satisfy. */
|
|
259
|
+
readonly ruleTags: readonly string[];
|
|
260
|
+
/**
|
|
261
|
+
* Whether this field reads its value, or the options it offers, from
|
|
262
|
+
* somewhere other than the user — so the Data-Source specialist must author
|
|
263
|
+
* its `matOptions` against the endpoint catalog.
|
|
264
|
+
*
|
|
265
|
+
* Offered to the Architect **only** while a catalog is bound
|
|
266
|
+
* (`withAiEndpointCatalog()`). With none bound there is nothing to point at,
|
|
267
|
+
* and a flag the pipeline cannot honour is worse than no flag at all.
|
|
268
|
+
*/
|
|
269
|
+
readonly needsDataSource?: boolean;
|
|
270
|
+
/**
|
|
271
|
+
* Whether this field asks the user to pick a municipal SCOA account — so the
|
|
272
|
+
* MSCOA specialist must author its `mscoaConfig`.
|
|
273
|
+
*
|
|
274
|
+
* Offered to the Architect **only** while chart-of-accounts grounding is
|
|
275
|
+
* bound (`withAiMscoaGrounding()`), for the same reason as
|
|
276
|
+
* {@link needsDataSource}.
|
|
277
|
+
*/
|
|
278
|
+
readonly needsMscoa?: boolean;
|
|
279
|
+
/**
|
|
280
|
+
* Whether this field carries a rule beyond being filled in — a custom
|
|
281
|
+
* validator, a visibility condition, or a value computed from other fields.
|
|
282
|
+
*
|
|
283
|
+
* The Logic specialist runs as **one batched turn over every field flagged
|
|
284
|
+
* this way**, because all three members share one expression DSL and one
|
|
285
|
+
* sibling-field roster; splitting them would yield three agents needing the
|
|
286
|
+
* same context (AI_FORM_BUILDER_DESIGN.md §2).
|
|
287
|
+
*/
|
|
288
|
+
readonly needsLogic?: boolean;
|
|
289
|
+
/**
|
|
290
|
+
* The rule to encode, in one sentence and in the brief's own terms. Read only
|
|
291
|
+
* when {@link needsLogic} is set; with nothing stated the Logic specialist
|
|
292
|
+
* works from {@link ruleTags} and the rules ledger alone.
|
|
293
|
+
*/
|
|
294
|
+
readonly logicIntent?: string;
|
|
295
|
+
}
|
|
296
|
+
/** A planned slide — a titled group of field stubs. */
|
|
297
|
+
interface BlueprintSlide {
|
|
298
|
+
/** Slide heading shown to the end user. */
|
|
299
|
+
readonly label: string;
|
|
300
|
+
/** Field stubs belonging to this slide. */
|
|
301
|
+
readonly fields: readonly BlueprintField[];
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* The Architect's plan: slides, field stubs and rule trace tags, produced before
|
|
305
|
+
* the expensive per-column generation step so it is cheap to re-run.
|
|
306
|
+
*/
|
|
307
|
+
interface FormBlueprint {
|
|
308
|
+
/** Title carried through to the generated form. */
|
|
309
|
+
readonly formTitle: string;
|
|
310
|
+
/** Planned slides, in presentation order. */
|
|
311
|
+
readonly slides: readonly BlueprintSlide[];
|
|
312
|
+
/**
|
|
313
|
+
* Ids of the catalog endpoints the completed form is submitted to, becoming
|
|
314
|
+
* `submissionHandle.submissionAPI` once expansion resolves each id to its
|
|
315
|
+
* stored configuration.
|
|
316
|
+
*
|
|
317
|
+
* Offered to the Architect **only** while a bound catalog declares at least
|
|
318
|
+
* one endpoint for the `submission` slot — a form-level decision, made once by
|
|
319
|
+
* the agent that can see the whole brief, rather than by a per-field
|
|
320
|
+
* specialist that cannot.
|
|
321
|
+
*/
|
|
322
|
+
readonly submissionEndpointIds?: readonly string[];
|
|
323
|
+
/**
|
|
324
|
+
* Ids of the catalog endpoints that **gate** submission, becoming
|
|
325
|
+
* `submissionHandle.canSubmitAPI` once expansion resolves each id to its
|
|
326
|
+
* stored configuration.
|
|
327
|
+
*
|
|
328
|
+
* Offered to the Architect on exactly the terms {@link submissionEndpointIds}
|
|
329
|
+
* is, and absent for the same reason when the bound catalog declares no
|
|
330
|
+
* `canSubmit` endpoint: an id nothing can resolve is worse than no gate.
|
|
331
|
+
*
|
|
332
|
+
* Not interchangeable with {@link submissionEndpointIds}. A gate is *asked*
|
|
333
|
+
* before the form is sent and may refuse it, so an endpoint that is a valid
|
|
334
|
+
* submission target is not thereby a valid gate. Only the catalog knows which
|
|
335
|
+
* is which, and this pipeline never infers it.
|
|
336
|
+
*/
|
|
337
|
+
readonly canSubmitEndpointIds?: readonly string[];
|
|
338
|
+
/**
|
|
339
|
+
* Control names of **baseline** fields this plan removes on purpose.
|
|
340
|
+
*
|
|
341
|
+
* Offered to the Architect **only** in update mode — when the session carries
|
|
342
|
+
* a {@link DraftSession.baseline} — and read by the baseline-preservation
|
|
343
|
+
* gate: a baseline field that is neither in the plan nor named here is a
|
|
344
|
+
* blocking finding routed back to the Architect, because silently dropping a
|
|
345
|
+
* saved field is the regression an update must never make. Each name here
|
|
346
|
+
* should be justified by a brief rule.
|
|
347
|
+
*/
|
|
348
|
+
readonly removedFields?: readonly string[];
|
|
349
|
+
}
|
|
350
|
+
/** What a {@link DraftFinding} is about. */
|
|
351
|
+
type DraftFindingKind =
|
|
352
|
+
/** Joi rejected the assembled form. */
|
|
353
|
+
'validation'
|
|
354
|
+
/** A generated reference does not resolve within the form. */
|
|
355
|
+
| 'integrity'
|
|
356
|
+
/** A brief rule is not mapped to any field. */
|
|
357
|
+
| 'coverage'
|
|
358
|
+
/** A UX-heuristic observation. */
|
|
359
|
+
| 'ux';
|
|
360
|
+
/** Whether a finding stops the pipeline or is merely reported. */
|
|
361
|
+
type DraftFindingSeverity = 'blocking' | 'advisory';
|
|
362
|
+
/**
|
|
363
|
+
* A typed, machine-routable observation about a draft. Findings gate the repair
|
|
364
|
+
* loop and are surfaced to the user when a budget is exhausted.
|
|
365
|
+
*/
|
|
366
|
+
interface DraftFinding {
|
|
367
|
+
/** What the finding is about. */
|
|
368
|
+
readonly kind: DraftFindingKind;
|
|
369
|
+
/** Whether it blocks acceptance. */
|
|
370
|
+
readonly severity: DraftFindingSeverity;
|
|
371
|
+
/** Dotted path or rule id the finding refers to. */
|
|
372
|
+
readonly target: string;
|
|
373
|
+
/** Human-readable description; also used verbatim as the repair prompt. */
|
|
374
|
+
readonly message: string;
|
|
375
|
+
/** Optional concrete correction. */
|
|
376
|
+
readonly suggestedFix?: string;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* What one drafting **session** has cost, in units the library can actually
|
|
380
|
+
* count.
|
|
381
|
+
*
|
|
382
|
+
* Deliberately narrow. A **call** is one `DraftTransport.complete()`
|
|
383
|
+
* invocation, and that is the only unit the orchestrator observes. Tokens,
|
|
384
|
+
* money and wall-clock time are the transport's business: the library never
|
|
385
|
+
* sees a usage report, so any member claiming to hold one would be an
|
|
386
|
+
* estimate dressed as a measurement. A host that needs spend meters its own
|
|
387
|
+
* adapter, where the provider's real numbers are.
|
|
388
|
+
*
|
|
389
|
+
* ## Scope: the session, not one run
|
|
390
|
+
*
|
|
391
|
+
* Every count accumulates over the whole session — the intake conversation
|
|
392
|
+
* plus **every** `generate()` run made on it — and is cleared only when the
|
|
393
|
+
* session itself is, by `FormDraftOrchestrator.reset()`. Two runs on one
|
|
394
|
+
* session therefore report their combined cost, not the second run's.
|
|
395
|
+
*
|
|
396
|
+
* It is scoped that way because one of the things it counts could not be
|
|
397
|
+
* attributed to a run at all: intake is a conversation, not a run, and the
|
|
398
|
+
* Analyst turns it spends happen *before* the first `generate()` call. A
|
|
399
|
+
* per-run counter would have nowhere to put them, which would make
|
|
400
|
+
* `intake` — named in {@link callsByStage} as a stage this record carries —
|
|
401
|
+
* permanently unreachable. Counting the session keeps every call the
|
|
402
|
+
* orchestrator issued in exactly one place.
|
|
403
|
+
*
|
|
404
|
+
* A host that wants one run's figures subtracts two snapshots: read the counts
|
|
405
|
+
* before calling `generate()` and again when its observable completes. Nothing
|
|
406
|
+
* here ever decreases, so that difference is always meaningful.
|
|
407
|
+
*
|
|
408
|
+
* Loop counters are deliberately **not** repeated here — rounds live on
|
|
409
|
+
* {@link DraftSession.repairTurnsUsed} and
|
|
410
|
+
* {@link DraftSession.critiqueRoundsUsed}. Carrying them in two places would
|
|
411
|
+
* make one fact into two numbers that can drift apart; read them from the
|
|
412
|
+
* session alongside this. Mind that those two are scoped to the run in flight
|
|
413
|
+
* and are cleared when the next one starts, while these counts carry across.
|
|
414
|
+
*
|
|
415
|
+
* Every count is cumulative over the session and never decreases within it.
|
|
416
|
+
*/
|
|
417
|
+
interface DraftTelemetry {
|
|
418
|
+
/** Total `DraftTransport.complete()` calls issued so far this session. */
|
|
419
|
+
readonly totalCalls: number;
|
|
420
|
+
/**
|
|
421
|
+
* Calls issued per pipeline role, over the whole session.
|
|
422
|
+
*
|
|
423
|
+
* A missing key means zero: a role that never ran — an unbound specialist,
|
|
424
|
+
* or the Critic on a draft it was never asked about — carries no entry.
|
|
425
|
+
*/
|
|
426
|
+
readonly callsByRole: Partial<Record<AiFormBuilderRole, number>>;
|
|
427
|
+
/**
|
|
428
|
+
* Calls issued per lifecycle stage — the stage current when each call was
|
|
429
|
+
* made, which is where the run's effort actually went.
|
|
430
|
+
*
|
|
431
|
+
* Not a restatement of {@link callsByRole}: a repair turn re-invokes the
|
|
432
|
+
* Generator and the specialists, so their role counts fold first-pass and
|
|
433
|
+
* repair work into one number while `repairing` isolates what the inner
|
|
434
|
+
* loop cost. The outer loop splits the same way — `critiquing` is what the
|
|
435
|
+
* Critic's review turns cost, while the re-plans those reviews trigger are
|
|
436
|
+
* counted under `planning` alongside the first plan, because a revision is
|
|
437
|
+
* the Architect planning again. Stages that issue no calls — `idle`,
|
|
438
|
+
* `assembling`, `verifying`, `staged`, `failed` — carry no key, as does any
|
|
439
|
+
* stage the session never entered.
|
|
440
|
+
*/
|
|
441
|
+
readonly callsByStage: Partial<Record<DraftStage, number>>;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* The most recent partial structured output of a turn that is still in flight.
|
|
445
|
+
*
|
|
446
|
+
* **This is a progress signal for the panel, and nothing else.** It is
|
|
447
|
+
* emphatically *not* a form filling in on the canvas: only a Joi-validated form
|
|
448
|
+
* ever reaches the canvas (AI_FORM_BUILDER_DESIGN.md §5.1 rule 4), and a
|
|
449
|
+
* half-written plan or a half-written column is not one. Nothing in the
|
|
450
|
+
* pipeline reads a partial — no verification, no repair routing, no staging
|
|
451
|
+
* decision — so a run that never receives one is identical to a run that
|
|
452
|
+
* receives many.
|
|
453
|
+
*
|
|
454
|
+
* Absent whenever nothing is streaming: no transport that streams is bound, the
|
|
455
|
+
* turn in flight is not one of the two that stream, or the run has finished.
|
|
456
|
+
*/
|
|
457
|
+
interface DraftPartial {
|
|
458
|
+
/** Which role's turn produced it. */
|
|
459
|
+
readonly role: AiFormBuilderRole;
|
|
460
|
+
/**
|
|
461
|
+
* The value so far.
|
|
462
|
+
*
|
|
463
|
+
* `unknown` for the same reason the schema that describes it is: it is the
|
|
464
|
+
* shape of that schema with any subset of its members still missing or
|
|
465
|
+
* half-written. Narrow it defensively and never treat one as final.
|
|
466
|
+
*/
|
|
467
|
+
readonly value: unknown;
|
|
468
|
+
/**
|
|
469
|
+
* Which slide is being generated, present only on a Field Generator turn —
|
|
470
|
+
* slides are generated in parallel, so without it a panel cannot tell two
|
|
471
|
+
* concurrent streams apart.
|
|
472
|
+
*/
|
|
473
|
+
readonly slideIndex?: number;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* The diagnostic record of the **thrown** error that ended a run — kept whole,
|
|
477
|
+
* so a failure can be debugged rather than only read.
|
|
478
|
+
*
|
|
479
|
+
* Present on a `failed` session only when the run stopped on an exception: a
|
|
480
|
+
* transport error, a model answer the pipeline could not use even after
|
|
481
|
+
* repair, or a defect in the pipeline itself. A run that stopped by its own
|
|
482
|
+
* rules — no brief to build from, a spent repair budget — is an outcome, not a
|
|
483
|
+
* crash, and carries {@link DraftSession.error} alone.
|
|
484
|
+
*
|
|
485
|
+
* The same error object is also handed to Angular's `ErrorHandler`, so with the
|
|
486
|
+
* default handler it reaches the console with its stack, and a host that has
|
|
487
|
+
* replaced the handler with an error reporter receives it there. This record
|
|
488
|
+
* is what lets the *panel* show the same thing, in place, without a console.
|
|
489
|
+
*/
|
|
490
|
+
interface DraftFailure {
|
|
491
|
+
/** The error's class name — `TypeError`, `DraftOutputError`, … */
|
|
492
|
+
readonly name: string;
|
|
493
|
+
/** The error's message; the same text as {@link DraftSession.error}. */
|
|
494
|
+
readonly message: string;
|
|
495
|
+
/** The stack trace as the runtime produced it, when it produced one. */
|
|
496
|
+
readonly stack?: string;
|
|
497
|
+
/** The lifecycle stage the error interrupted. */
|
|
498
|
+
readonly stage: DraftStage;
|
|
499
|
+
/**
|
|
500
|
+
* The role whose completion the error came out of, when it came out of one.
|
|
501
|
+
* Absent for an error thrown between completions — by assembly, say.
|
|
502
|
+
*/
|
|
503
|
+
readonly role?: AiFormBuilderRole;
|
|
504
|
+
/** A description of the error's own `cause`, when it carried one. */
|
|
505
|
+
readonly cause?: string;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Where one round of repair work was sent.
|
|
509
|
+
*
|
|
510
|
+
* Every member is present so a host can render the route without probing: an
|
|
511
|
+
* empty list means nothing of that kind was involved in the round.
|
|
512
|
+
*/
|
|
513
|
+
interface DraftRepairRoute {
|
|
514
|
+
/** Whether the Architect was asked to correct the plan this round. */
|
|
515
|
+
readonly architect: boolean;
|
|
516
|
+
/** Slide indexes the Field Generator re-ran. */
|
|
517
|
+
readonly slides: readonly number[];
|
|
518
|
+
/** Specialist turns re-run, each with the control names it was asked about. */
|
|
519
|
+
readonly specialists: readonly {
|
|
520
|
+
readonly role: AiFormBuilderRole;
|
|
521
|
+
readonly fields: readonly string[];
|
|
522
|
+
}[];
|
|
523
|
+
/**
|
|
524
|
+
* Members withdrawn deterministically rather than re-asked, as
|
|
525
|
+
* `<formControlName>.<member>` — the escalation taken when a specialist had
|
|
526
|
+
* failed to correct the same member twice. The column keeps working without
|
|
527
|
+
* it; the author finishes it on the canvas.
|
|
528
|
+
*/
|
|
529
|
+
readonly retracted: readonly string[];
|
|
530
|
+
/**
|
|
531
|
+
* Findings escalated from the Field Generator to the Architect, by target —
|
|
532
|
+
* taken when a column could not be generated validly twice in a row, so the
|
|
533
|
+
* plan for that field, not the column, is what gets changed.
|
|
534
|
+
*/
|
|
535
|
+
readonly escalated: readonly string[];
|
|
536
|
+
}
|
|
537
|
+
/** What kind of turn a {@link DraftRepairTurn} records. */
|
|
538
|
+
type DraftRepairTurnKind =
|
|
539
|
+
/** The Architect correcting its own plan before any column was generated. */
|
|
540
|
+
'plan'
|
|
541
|
+
/** A routed repair of an assembled form that failed a deterministic gate. */
|
|
542
|
+
| 'repair'
|
|
543
|
+
/** A deterministic withdrawal of members no repair could fix; no model call. */
|
|
544
|
+
| 'retraction'
|
|
545
|
+
/** A re-plan answering the Critic's blocking findings. */
|
|
546
|
+
| 'revision';
|
|
547
|
+
/**
|
|
548
|
+
* One entry of the run's **repair log** — the record a host renders so a
|
|
549
|
+
* failed or repaired run explains itself: what was wrong, who was asked to fix
|
|
550
|
+
* it, and whether it worked.
|
|
551
|
+
*
|
|
552
|
+
* Entries are appended in order and never rewritten, except that
|
|
553
|
+
* {@link outcome} is filled in once the verification that follows the turn has
|
|
554
|
+
* run. A run that stages on the first pass carries an empty log.
|
|
555
|
+
*/
|
|
556
|
+
interface DraftRepairTurn {
|
|
557
|
+
/** 1-based position in the run's log. */
|
|
558
|
+
readonly sequence: number;
|
|
559
|
+
/** What kind of turn this was. */
|
|
560
|
+
readonly kind: DraftRepairTurnKind;
|
|
561
|
+
/**
|
|
562
|
+
* The blocking findings the turn set out to correct. For a `retraction` these
|
|
563
|
+
* are the findings whose members were withdrawn; for a `revision` they are
|
|
564
|
+
* the Critic's blocking findings.
|
|
565
|
+
*/
|
|
566
|
+
readonly findings: readonly DraftFinding[];
|
|
567
|
+
/** Where the work was sent. */
|
|
568
|
+
readonly route: DraftRepairRoute;
|
|
569
|
+
/**
|
|
570
|
+
* What the next verification found, relative to {@link findings}: how many
|
|
571
|
+
* of them were gone, how many came back unchanged, and how many new blocking
|
|
572
|
+
* findings appeared. Absent until that verification has run, and on the last
|
|
573
|
+
* turn of a run that was cancelled.
|
|
574
|
+
*/
|
|
575
|
+
readonly outcome?: {
|
|
576
|
+
readonly resolved: number;
|
|
577
|
+
readonly persisted: number;
|
|
578
|
+
readonly introduced: number;
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Options for one intake turn. See {@link FormDraftOrchestrator.describe}.
|
|
583
|
+
*/
|
|
584
|
+
interface DescribeOptions {
|
|
585
|
+
/**
|
|
586
|
+
* A saved form the conversation is about **changing**, rather than a new
|
|
587
|
+
* one being described from nothing.
|
|
588
|
+
*
|
|
589
|
+
* Setting it puts the session in **update mode** for every run until
|
|
590
|
+
* `reset()`: the Analyst records the requested changes as ledger rules, the
|
|
591
|
+
* Architect starts from the plan the baseline already embodies, only the
|
|
592
|
+
* fields the plan changes are regenerated, every other column comes back
|
|
593
|
+
* byte-for-byte — identifiers included, so a staged result is the same form
|
|
594
|
+
* with the requested edits rather than a re-keyed twin — and a baseline
|
|
595
|
+
* field dropped or altered without a rule to justify it is a blocking
|
|
596
|
+
* finding. Hand the orchestrator the form exactly as the canvas holds it.
|
|
597
|
+
*/
|
|
598
|
+
readonly baseline?: FormInterface;
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Immutable snapshot of a drafting session. The orchestrator republishes a new
|
|
602
|
+
* snapshot on every stage transition; the panel renders straight from it.
|
|
603
|
+
*/
|
|
604
|
+
interface DraftSession {
|
|
605
|
+
/** Stable id for this session. */
|
|
606
|
+
readonly id: string;
|
|
607
|
+
/** Current lifecycle stage. */
|
|
608
|
+
readonly stage: DraftStage;
|
|
609
|
+
/** Intake conversation so far. */
|
|
610
|
+
readonly conversation: readonly DraftMessage[];
|
|
611
|
+
/** Latest brief, once the Analyst has produced one. */
|
|
612
|
+
readonly brief?: FormBrief;
|
|
613
|
+
/** Latest plan, once the Architect has produced one. */
|
|
614
|
+
readonly blueprint?: FormBlueprint;
|
|
615
|
+
/**
|
|
616
|
+
* The assembled, expanded and **Joi-validated** form: present only in the
|
|
617
|
+
* `staged` stage, and only ever holding a form that cleared verification with
|
|
618
|
+
* no blocking finding left standing.
|
|
619
|
+
*
|
|
620
|
+
* This is the one member a host may load onto the canvas. Because it has
|
|
621
|
+
* passed exactly the validation a *stored* form passes, staging it cannot put
|
|
622
|
+
* anything through the load path that the canvas could not already receive.
|
|
623
|
+
* Never persisted by the library. Contrast {@link candidateForm}.
|
|
624
|
+
*/
|
|
625
|
+
readonly form?: FormInterface;
|
|
626
|
+
/**
|
|
627
|
+
* The best-effort form the pipeline actually built, published when a run ends
|
|
628
|
+
* in `failed` because its repair budget ran out.
|
|
629
|
+
*
|
|
630
|
+
* **It did not pass validation.** Every blocking entry in {@link findings} is
|
|
631
|
+
* a defect still standing in it, so it is not a form — it is the wreckage of
|
|
632
|
+
* one, kept so a human can read, diff or salvage the run's work instead of
|
|
633
|
+
* losing it. It is never a stand-in for {@link form}: loading it onto the
|
|
634
|
+
* canvas would push a form through the load path that could never have been
|
|
635
|
+
* stored, which is the guarantee staging rests on. A host that offers it must
|
|
636
|
+
* present it as rejected output, behind the findings that rejected it.
|
|
637
|
+
*
|
|
638
|
+
* Unset on every other stage, and cleared at the start of each run.
|
|
639
|
+
*/
|
|
640
|
+
readonly candidateForm?: FormInterface;
|
|
641
|
+
/** Outstanding findings, including any left over when a budget ran out. */
|
|
642
|
+
readonly findings: readonly DraftFinding[];
|
|
643
|
+
/** Repair turns consumed so far. */
|
|
644
|
+
readonly repairTurnsUsed: number;
|
|
645
|
+
/**
|
|
646
|
+
* Critique rounds consumed so far — the outer loop's counterpart to
|
|
647
|
+
* {@link repairTurnsUsed}, bounded by
|
|
648
|
+
* {@link AiFormBuilderBudgets.critiqueRounds}.
|
|
649
|
+
*
|
|
650
|
+
* Absent rather than `0` on a run that never reached the Critic, so a host
|
|
651
|
+
* can tell *the outer loop ran and converged on the first pass* (`0`) from
|
|
652
|
+
* *the outer loop never ran at all* (`undefined`) — the Critic is skipped
|
|
653
|
+
* whenever verification never produced a form worth critiquing. Read it as
|
|
654
|
+
* `critiqueRoundsUsed ?? 0` only where that difference genuinely does not
|
|
655
|
+
* matter.
|
|
656
|
+
*/
|
|
657
|
+
readonly critiqueRoundsUsed?: number;
|
|
658
|
+
/**
|
|
659
|
+
* Whether this session reached `staged` carrying critique findings the outer
|
|
660
|
+
* loop never cleared.
|
|
661
|
+
*
|
|
662
|
+
* The two loops end differently, and this is the member that records it. A
|
|
663
|
+
* run whose *repair* budget runs out has not passed Joi, so it fails and
|
|
664
|
+
* stages nothing — its work goes to {@link candidateForm}. A run whose
|
|
665
|
+
* *critique* budget runs out has already passed every deterministic gate:
|
|
666
|
+
* the form is valid and the Critic simply still has coverage or UX
|
|
667
|
+
* observations about it. That run stages, and its leftover findings are
|
|
668
|
+
* surfaced as `advisory` in {@link findings}. {@link form}'s guarantee is
|
|
669
|
+
* untouched — no blocking finding is ever left standing on a staged form.
|
|
670
|
+
*
|
|
671
|
+
* Not derivable from {@link findings}. A staged session can carry advisory
|
|
672
|
+
* findings with no Critic having run at all, because deterministic
|
|
673
|
+
* verification emits advisories of its own, so *there are advisories* does
|
|
674
|
+
* not mean *the outer loop gave up*. Only this flag says the Critic ran and
|
|
675
|
+
* did not converge — the difference between a clean result and one a human
|
|
676
|
+
* should read before accepting.
|
|
677
|
+
*
|
|
678
|
+
* Absent means no: either the outer loop converged, or it never ran.
|
|
679
|
+
*/
|
|
680
|
+
readonly stagedWithOutstandingFindings?: boolean;
|
|
681
|
+
/**
|
|
682
|
+
* What the run has cost so far, in calls the orchestrator actually counted.
|
|
683
|
+
*
|
|
684
|
+
* Republished with every stage transition, so a panel can meter a run while
|
|
685
|
+
* it is still in flight rather than only once it ends. Absent on a session
|
|
686
|
+
* no run has touched.
|
|
687
|
+
*/
|
|
688
|
+
readonly telemetry?: DraftTelemetry;
|
|
689
|
+
/**
|
|
690
|
+
* The latest partial output of a streaming turn, for a progress display.
|
|
691
|
+
*
|
|
692
|
+
* Cleared when a run starts and again when it ends, so a partial is present
|
|
693
|
+
* only while something is genuinely in flight. See {@link DraftPartial} for
|
|
694
|
+
* why it never reaches the canvas.
|
|
695
|
+
*/
|
|
696
|
+
readonly partial?: DraftPartial;
|
|
697
|
+
/**
|
|
698
|
+
* The run's repair log, in order — see {@link DraftRepairTurn}.
|
|
699
|
+
*
|
|
700
|
+
* The transparency record: for every turn the pipeline spent correcting the
|
|
701
|
+
* draft, which findings it addressed, who it asked, what it withdrew or
|
|
702
|
+
* escalated, and whether the next verification bore that out. Present from
|
|
703
|
+
* the first repair turn of a run, cleared when the next run starts; absent on
|
|
704
|
+
* a session no run has repaired.
|
|
705
|
+
*/
|
|
706
|
+
readonly repairLog?: readonly DraftRepairTurn[];
|
|
707
|
+
/**
|
|
708
|
+
* The saved form this session is editing, when it is editing one — see
|
|
709
|
+
* {@link DescribeOptions.baseline}. Absent on a session drafting a new form.
|
|
710
|
+
*/
|
|
711
|
+
readonly baseline?: FormInterface;
|
|
712
|
+
/** Message describing why the session reached `failed`. */
|
|
713
|
+
readonly error?: string;
|
|
714
|
+
/**
|
|
715
|
+
* The thrown error that ended the run, whole — see {@link DraftFailure}.
|
|
716
|
+
*
|
|
717
|
+
* Set alongside {@link error} when the run crashed; absent when it stopped by
|
|
718
|
+
* its own rules. Cleared at the start of the next run and by the next
|
|
719
|
+
* `describe()` turn, both of which start clean from a failed session.
|
|
720
|
+
*/
|
|
721
|
+
readonly failure?: DraftFailure;
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Loop budgets.
|
|
725
|
+
*
|
|
726
|
+
* The two budgets exhaust to opposite outcomes, and the difference is not
|
|
727
|
+
* incidental — it follows from what each loop is waiting for:
|
|
728
|
+
*
|
|
729
|
+
* - {@link repairTurns} guards the deterministic loop, whose draft has NOT
|
|
730
|
+
* passed Joi. Exhaustion fails the run: every finding is surfaced and the
|
|
731
|
+
* rejected draft is published on {@link DraftSession.candidateForm}, but an
|
|
732
|
+
* unverified form is never staged.
|
|
733
|
+
* - {@link critiqueRounds} guards the Critic loop, which only ever sees a form
|
|
734
|
+
* that already passed Joi. Exhaustion **stages** it, with the outstanding
|
|
735
|
+
* findings downgraded to advisory and
|
|
736
|
+
* {@link DraftSession.stagedWithOutstandingFindings} set — the human is the
|
|
737
|
+
* intended judge of a form that is valid but imperfect.
|
|
738
|
+
*/
|
|
739
|
+
interface AiFormBuilderBudgets {
|
|
740
|
+
/** Deterministic-failure repair turns per generation. Default 3. */
|
|
741
|
+
readonly repairTurns?: number;
|
|
742
|
+
/**
|
|
743
|
+
* Critic revision rounds. Default 2. Reserved for Phase 3.
|
|
744
|
+
*
|
|
745
|
+
* Consumption is reported on {@link DraftSession.critiqueRoundsUsed}, and
|
|
746
|
+
* exhausting it stages the form with its leftover findings rather than
|
|
747
|
+
* failing the run — see {@link DraftSession.stagedWithOutstandingFindings}.
|
|
748
|
+
*/
|
|
749
|
+
readonly critiqueRounds?: number;
|
|
750
|
+
}
|
|
751
|
+
/** Model selection per tier, with optional per-role overrides. */
|
|
752
|
+
interface AiFormBuilderModels {
|
|
753
|
+
/** Model for judgment-heavy roles (analyst, architect, critic). */
|
|
754
|
+
readonly planning: string;
|
|
755
|
+
/** Model for schema-fill roles. Defaults to {@link planning}. */
|
|
756
|
+
readonly worker?: string;
|
|
757
|
+
/** Per-role override, taking precedence over the tier default. */
|
|
758
|
+
readonly overrides?: Partial<Record<AiFormBuilderRole, string>>;
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* One hook over the `fetch` options of every request this feature sends.
|
|
762
|
+
*
|
|
763
|
+
* Declared here as a plain function over the platform `RequestInit` rather
|
|
764
|
+
* than as Hashbrown's own `Chat.Middleware`, for the reason every other member
|
|
765
|
+
* of this ring avoids `@hashbrownai/*`: naming that type would drag the
|
|
766
|
+
* optional peer into the domain ring, where it is reachable from every
|
|
767
|
+
* consumer of these models rather than only from the code that installs
|
|
768
|
+
* `withAiFormBuilder()`. The two are structurally identical, so a consumer
|
|
769
|
+
* can hand the same functions to both this feature and its own Hashbrown
|
|
770
|
+
* resources.
|
|
771
|
+
*
|
|
772
|
+
* Runs in order, on the transport, immediately before the request leaves the
|
|
773
|
+
* browser. Return the options to send; throw to refuse the request, which
|
|
774
|
+
* fails the turn the way a transport error does.
|
|
775
|
+
*/
|
|
776
|
+
type DraftRequestMiddleware = (fetchInit: RequestInit) => RequestInit | Promise<RequestInit>;
|
|
777
|
+
/**
|
|
778
|
+
* Consumer-supplied configuration for the AI form-builder feature.
|
|
779
|
+
*
|
|
780
|
+
* The library never names a vendor or a model: `models.planning` is an opaque
|
|
781
|
+
* identifier forwarded to the consumer's own Hashbrown adapter.
|
|
782
|
+
*/
|
|
783
|
+
interface AiFormBuilderConfig {
|
|
784
|
+
/** Model per tier. */
|
|
785
|
+
readonly models: AiFormBuilderModels;
|
|
786
|
+
/** Loop budgets. Defaults applied by the orchestrator. */
|
|
787
|
+
readonly budgets?: AiFormBuilderBudgets;
|
|
788
|
+
/**
|
|
789
|
+
* Element union offered to the model. Defaults to the skillet
|
|
790
|
+
* `COMMON_ELEMENTS` set, which keeps the generated JSON Schema roughly a
|
|
791
|
+
* third the size of the full union.
|
|
792
|
+
*/
|
|
793
|
+
readonly elements?: readonly ElementTypes[];
|
|
794
|
+
/** `MultipleInput` unroll depth passed to the skillet schema. Default 1. */
|
|
795
|
+
readonly nestingDepth?: number;
|
|
796
|
+
/**
|
|
797
|
+
* Overrides the Hashbrown API base URL for this feature's requests only.
|
|
798
|
+
* When omitted the adapter's own default applies.
|
|
799
|
+
*/
|
|
800
|
+
readonly apiUrl?: string;
|
|
801
|
+
/**
|
|
802
|
+
* Hooks applied to the `fetch` options of every request this feature sends,
|
|
803
|
+
* in order, before it leaves the browser.
|
|
804
|
+
*
|
|
805
|
+
* The transport calls `fetch` directly, so nothing else your app configures
|
|
806
|
+
* — an HTTP interceptor chain, a global Hashbrown provider — ever sees these
|
|
807
|
+
* requests. This is the one place to attach what your adapter endpoint
|
|
808
|
+
* needs to accept them: `credentials: 'include'` for a cookie-authenticated
|
|
809
|
+
* endpoint on another origin, an authorisation header, a request-size guard.
|
|
810
|
+
* Scoped to this feature's requests only, exactly as {@link apiUrl} is.
|
|
811
|
+
*
|
|
812
|
+
* When omitted the request goes out with `fetch`'s defaults, which send no
|
|
813
|
+
* cookies cross-origin.
|
|
814
|
+
*/
|
|
815
|
+
readonly middleware?: readonly DraftRequestMiddleware[];
|
|
816
|
+
/**
|
|
817
|
+
* Structured-output mode forwarded to Hashbrown. Use `'json'` when the
|
|
818
|
+
* provider rejects the schema as too large for schema-constrained decoding.
|
|
819
|
+
* Default `'strict'`.
|
|
820
|
+
*/
|
|
821
|
+
readonly structuredOutputMode?: 'strict' | 'json' | 'tool';
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* @public
|
|
826
|
+
*
|
|
827
|
+
* Enables the **AI form-builder** layer. Binds the supplied configuration to
|
|
828
|
+
* {@link AI_FORM_BUILDER_CONFIG} and the default
|
|
829
|
+
* {@link HashbrownFormDraftOrchestratorService} to {@link FORM_DRAFT_ORCHESTRATOR},
|
|
830
|
+
* so a natural-language brief can be turned into a validated form definition and
|
|
831
|
+
* staged on the form-builder canvas for human review.
|
|
832
|
+
*
|
|
833
|
+
* The library never persists a generated form and never holds an API key: the
|
|
834
|
+
* consumer's own Hashbrown adapter owns the transport, and the human saves the
|
|
835
|
+
* staged draft through the ordinary form-builder save path.
|
|
836
|
+
*
|
|
837
|
+
* Opt-in and tree-shakeable: without this feature both tokens are unbound and
|
|
838
|
+
* none of the drafting code — including the optional `@hashbrownai/core` peer —
|
|
839
|
+
* is reachable from `provideNgxTForms()`.
|
|
840
|
+
*
|
|
841
|
+
* Consumers that supply their own {@link FormDraftOrchestrator} implementation
|
|
842
|
+
* should bind it directly to {@link FORM_DRAFT_ORCHESTRATOR} instead of (or
|
|
843
|
+
* after) calling this — provider order resolution applies.
|
|
844
|
+
*
|
|
845
|
+
* @example
|
|
846
|
+
* bootstrapApplication(AppComponent, {
|
|
847
|
+
* providers: [
|
|
848
|
+
* provideNgxTForms(
|
|
849
|
+
* config,
|
|
850
|
+
* withAiFormBuilder({
|
|
851
|
+
* models: { planning: 'my-planning-model', worker: 'my-worker-model' },
|
|
852
|
+
* }),
|
|
853
|
+
* ),
|
|
854
|
+
* ],
|
|
855
|
+
* });
|
|
856
|
+
*/
|
|
857
|
+
declare function withAiFormBuilder(config: AiFormBuilderConfig): NgxTFormsFeature;
|
|
858
|
+
|
|
859
|
+
/**
|
|
860
|
+
* @file The **endpoint catalog** — the grounding that lets the drafting
|
|
861
|
+
* pipeline bind a generated form to endpoints that actually exist.
|
|
862
|
+
*
|
|
863
|
+
* Inner-ring module: every import is **type-only** and erased at compile time,
|
|
864
|
+
* and {@link toAvailableApiEndpoints} is a pure function over those types with
|
|
865
|
+
* no runtime dependency of its own. The constraint documented on
|
|
866
|
+
* `domain/form-suggestion.model.ts` therefore still holds — no Angular
|
|
867
|
+
* concretions, no library internals, no `@hashbrownai/*`.
|
|
868
|
+
*
|
|
869
|
+
* ## Why a catalog exists at all
|
|
870
|
+
*
|
|
871
|
+
* `createMatOptionsSchema` and `createFormDraftSchema` in
|
|
872
|
+
* `ngx-t-forms-types/skillet` do not let a model author an endpoint: they take
|
|
873
|
+
* the endpoints the caller has and emit an *enumeration over their ids*. Asked
|
|
874
|
+
* for a URL, a model produces `https://api.example.com/departments` — plausible,
|
|
875
|
+
* confidently wrong, and invisible until the form is used. So the model picks
|
|
876
|
+
* from a list, and this is the list.
|
|
877
|
+
*
|
|
878
|
+
* Without a catalog bound, the `api` data-source branch and the submission
|
|
879
|
+
* endpoint are simply not offered, and a draft comes back with no endpoint
|
|
880
|
+
* selected. That is the safe default, not a degraded one.
|
|
881
|
+
*
|
|
882
|
+
* ## Why an entry carries the whole stored configuration
|
|
883
|
+
*
|
|
884
|
+
* {@link AiEndpointCatalogEntry.config} is a complete, already-persisted
|
|
885
|
+
* `APIDataFetchingConfigurationInterface` — not a URL, not a partial. Expansion
|
|
886
|
+
* of a draft is then a lookup on {@link AiEndpointCatalogEntry.id}, a structural
|
|
887
|
+
* clone and an overlay: pure, synchronous, and incapable of inventing a request.
|
|
888
|
+
* Anything less makes expansion guess at `httpMethod`, `postFormData`,
|
|
889
|
+
* `backEndConfig` and the header/query templates, which is the same
|
|
890
|
+
* hallucination one layer down.
|
|
891
|
+
*
|
|
892
|
+
* ## Why there is no workflow / `mongoPipeline` branch
|
|
893
|
+
*
|
|
894
|
+
* `MongoDbPipeLineConfigSchema` requires both `valueAccessRules` and a
|
|
895
|
+
* `responseBody` key that exists on no TypeScript interface, and `pipeline` is a
|
|
896
|
+
* raw aggregation that cannot be derived from a workflow id. A mongo branch
|
|
897
|
+
* therefore cannot be deterministically expanded into anything that passes its
|
|
898
|
+
* own Joi schema, so the pipeline never passes `workflows` to the skillet
|
|
899
|
+
* factories. API endpoints only.
|
|
900
|
+
*/
|
|
901
|
+
|
|
902
|
+
/**
|
|
903
|
+
* @public
|
|
904
|
+
*
|
|
905
|
+
* Where in a generated form an endpoint may legitimately be used.
|
|
906
|
+
*
|
|
907
|
+
* - `value` — supplies a control's value (`matOptions.fetch.value`).
|
|
908
|
+
* - `options` — supplies a control's option list (`matOptions.fetch.options`).
|
|
909
|
+
* - `submission` — receives the completed form (`submissionHandle.submissionAPI`).
|
|
910
|
+
* - `canSubmit` — gates submission (`submissionHandle.canSubmitAPI`).
|
|
911
|
+
*
|
|
912
|
+
* An entry declares every slot it is valid for; an endpoint is offered to the
|
|
913
|
+
* model for one slot only when it names that slot. A search endpoint that
|
|
914
|
+
* happens to answer a GET is not a submission target, and nothing but the
|
|
915
|
+
* consumer knows that.
|
|
916
|
+
*/
|
|
917
|
+
type AiEndpointSlot = 'value' | 'options' | 'submission' | 'canSubmit';
|
|
918
|
+
/**
|
|
919
|
+
* @public
|
|
920
|
+
*
|
|
921
|
+
* One endpoint the consumer makes available to the drafting pipeline.
|
|
922
|
+
*/
|
|
923
|
+
interface AiEndpointCatalogEntry {
|
|
924
|
+
/**
|
|
925
|
+
* Stable identifier the model selects by. It MUST equal `config._id` —
|
|
926
|
+
* expansion is a lookup on this id and then a clone of {@link config}, so a
|
|
927
|
+
* mismatch silently produces a form pointing at the wrong request.
|
|
928
|
+
*/
|
|
929
|
+
readonly id: string;
|
|
930
|
+
/**
|
|
931
|
+
* Human name. This is what the model actually chooses on: it is rendered into
|
|
932
|
+
* the schema's enumeration prose, so it should say what the endpoint is for
|
|
933
|
+
* rather than repeat its path.
|
|
934
|
+
*/
|
|
935
|
+
readonly name: string;
|
|
936
|
+
/**
|
|
937
|
+
* What the endpoint returns, in one sentence. Optional, and worth writing:
|
|
938
|
+
* it sharpens the choice considerably when two endpoints have similar names.
|
|
939
|
+
*/
|
|
940
|
+
readonly description?: string;
|
|
941
|
+
/** Slots this endpoint may be selected for. An entry with none is never offered. */
|
|
942
|
+
readonly slots: readonly AiEndpointSlot[];
|
|
943
|
+
/**
|
|
944
|
+
* The complete stored configuration, exactly as it is persisted on a form
|
|
945
|
+
* today. Cloned into the generated form during expansion; never synthesised,
|
|
946
|
+
* never partially filled in.
|
|
947
|
+
*/
|
|
948
|
+
readonly config: APIDataFetchingConfigurationInterface;
|
|
949
|
+
}
|
|
950
|
+
/**
|
|
951
|
+
* @public
|
|
952
|
+
*
|
|
953
|
+
* A function the library calls to obtain the catalog.
|
|
954
|
+
*
|
|
955
|
+
* This is the shape {@link AI_ENDPOINT_CATALOG} is bound to: `withAiEndpointCatalog()`
|
|
956
|
+
* normalises a plain array into one of these, so a reader has exactly one way
|
|
957
|
+
* to ask for the entries. Mirrors `MSCOA_TREE_PROVIDER`, which has the same
|
|
958
|
+
* "the consumer knows how to fetch it, the library does not" shape.
|
|
959
|
+
*
|
|
960
|
+
* The function is called lazily, when a draft first needs grounding — not at
|
|
961
|
+
* bootstrap — so a remote catalog costs nothing to a session that never drafts.
|
|
962
|
+
*/
|
|
963
|
+
type AiEndpointCatalogProvider = () => Observable<readonly AiEndpointCatalogEntry[]>;
|
|
964
|
+
/**
|
|
965
|
+
* @public
|
|
966
|
+
*
|
|
967
|
+
* What a consumer may hand {@link withAiEndpointCatalog}: either the entries
|
|
968
|
+
* outright, or a function that fetches them.
|
|
969
|
+
*
|
|
970
|
+
* The function form is the realistic one. There is no endpoint list sitting in
|
|
971
|
+
* consumer code today — endpoints are read out of a stored Postman collection
|
|
972
|
+
* over HTTP — so a catalog is normally resolved, not declared. The array form
|
|
973
|
+
* exists for the case where the consumer already holds the entries (tests,
|
|
974
|
+
* a static deployment) and should not be forced to wrap them.
|
|
975
|
+
*/
|
|
976
|
+
type AiEndpointCatalogSource = readonly AiEndpointCatalogEntry[] | AiEndpointCatalogProvider;
|
|
977
|
+
|
|
978
|
+
/**
|
|
979
|
+
* @public
|
|
980
|
+
*
|
|
981
|
+
* Grounds the AI form-builder on **endpoints that exist**. Binds the supplied
|
|
982
|
+
* catalog to {@link AI_ENDPOINT_CATALOG}, which is what lets the pipeline offer
|
|
983
|
+
* the `api` data source and a submission target: the model picks an endpoint id
|
|
984
|
+
* out of the catalog, and expansion clones the stored configuration behind it.
|
|
985
|
+
*
|
|
986
|
+
* Without this feature the token stays unbound, neither branch is offered, and
|
|
987
|
+
* a generated form comes back with no endpoint selected — the safe default,
|
|
988
|
+
* because the only alternative to a real endpoint is an invented URL that looks
|
|
989
|
+
* entirely plausible.
|
|
990
|
+
*
|
|
991
|
+
* Pass either the entries or a function that fetches them. The function form is
|
|
992
|
+
* the usual one — endpoints normally live in a stored Postman collection read
|
|
993
|
+
* over HTTP — and it is called lazily, when a draft first needs grounding, so a
|
|
994
|
+
* session that never drafts pays nothing. An array is normalised into a
|
|
995
|
+
* provider, so the token always holds one shape.
|
|
996
|
+
*
|
|
997
|
+
* Composes with {@link withAiFormBuilder} and {@link withAiMscoaGrounding};
|
|
998
|
+
* order is irrelevant, and this feature binds nothing but its own token.
|
|
999
|
+
*
|
|
1000
|
+
* @param source - The catalog entries, or a function returning them.
|
|
1001
|
+
* @returns The feature, for `provideNgxTForms(...)`.
|
|
1002
|
+
*
|
|
1003
|
+
* @example
|
|
1004
|
+
* // Resolved at first use — the realistic shape.
|
|
1005
|
+
* bootstrapApplication(AppComponent, {
|
|
1006
|
+
* providers: [
|
|
1007
|
+
* provideNgxTForms(
|
|
1008
|
+
* config,
|
|
1009
|
+
* withAiFormBuilder({ models: { planning: 'my-planning-model' } }),
|
|
1010
|
+
* withAiEndpointCatalog(() => inject(EndpointCatalogService).load()),
|
|
1011
|
+
* ),
|
|
1012
|
+
* ],
|
|
1013
|
+
* });
|
|
1014
|
+
*
|
|
1015
|
+
* @example
|
|
1016
|
+
* // Already held in hand — a static deployment, or a test.
|
|
1017
|
+
* withAiEndpointCatalog([
|
|
1018
|
+
* { id: storedConfig._id, name: 'Departments', slots: ['options'], config: storedConfig },
|
|
1019
|
+
* ]);
|
|
1020
|
+
*/
|
|
1021
|
+
declare function withAiEndpointCatalog(source: AiEndpointCatalogSource): NgxTFormsFeature;
|
|
1022
|
+
|
|
1023
|
+
/**
|
|
1024
|
+
* @file **MSCOA grounding** — the municipal chart-of-accounts facts a model
|
|
1025
|
+
* cannot infer from a prompt, supplied by the consumer so the drafting pipeline
|
|
1026
|
+
* can author an `mscoaSelection` control that names segments which exist.
|
|
1027
|
+
*
|
|
1028
|
+
* Inner-ring module: every import is **type-only** and erased at compile time.
|
|
1029
|
+
* No Angular concretions, no library internals, no `@hashbrownai/*`.
|
|
1030
|
+
*
|
|
1031
|
+
* ## What is actually missing without this
|
|
1032
|
+
*
|
|
1033
|
+
* `mscoaConfigSchema` (`ngx-t-forms-types/skillet`) already covers most of an
|
|
1034
|
+
* `IScoaInputConfig`: it enumerates `accountValueLabel` from the live option
|
|
1035
|
+
* pool, states the dual-cash semantics, and describes every segment flag. One
|
|
1036
|
+
* member it cannot constrain is `segment` itself, and its own description says
|
|
1037
|
+
* why — *"The real list comes from the loaded account tree, so use the key the
|
|
1038
|
+
* municipality actually publishes rather than inventing a plausible one."*
|
|
1039
|
+
* A model asked for segments produces ITEM, FUNCTION, FUND: correct for most
|
|
1040
|
+
* municipalities, silently wrong for one that publishes a different set, and
|
|
1041
|
+
* indistinguishable from correct on inspection.
|
|
1042
|
+
*
|
|
1043
|
+
* So the consumer names the segments. That is the whole job of this type.
|
|
1044
|
+
*
|
|
1045
|
+
* ## What it deliberately does not carry
|
|
1046
|
+
*
|
|
1047
|
+
* Not the account tree. The tree is large, per-tenant and already reachable at
|
|
1048
|
+
* runtime through `MSCOA_TREE_PROVIDER` (and, on the host, `getScoaTree()`);
|
|
1049
|
+
* duplicating it into a config object would put a second copy on a bootstrap
|
|
1050
|
+
* path that mostly never drafts a form. Nor account validation: that stays with
|
|
1051
|
+
* the host's `validateMscoaSelection`, which runs against a filled-in form, not
|
|
1052
|
+
* against a definition being authored.
|
|
1053
|
+
*
|
|
1054
|
+
* This is authoring-time metadata — a short, hand-written list — and nothing
|
|
1055
|
+
* here is read from `IStoreFunctions`. That interface opens with an
|
|
1056
|
+
* `[x: string]: any` index signature, so anything crossing that seam has to be
|
|
1057
|
+
* narrowed at the read site (the precedent is `t-form-import-controller.ts`
|
|
1058
|
+
* narrowing `getSCOAAccountByKey` to `Observable<{ account?: IScoaAccount }>`).
|
|
1059
|
+
* Keeping the seam out of this file is what guarantees no `any` reaches the
|
|
1060
|
+
* public surface, and it is why the shared `IStoreFunctions` needs no widening.
|
|
1061
|
+
*/
|
|
1062
|
+
|
|
1063
|
+
/**
|
|
1064
|
+
* @public
|
|
1065
|
+
*
|
|
1066
|
+
* Which side (or sides) of the books an `mscoaSelection` control captures.
|
|
1067
|
+
*
|
|
1068
|
+
* Declared as a string-literal union rather than re-exporting the
|
|
1069
|
+
* `AccountingBasis` enum, so a consumer can write `'dual'` without importing an
|
|
1070
|
+
* enum to say it. The two are pinned together below: an enum member is
|
|
1071
|
+
* assignable to this union, and drift fails the build.
|
|
1072
|
+
*/
|
|
1073
|
+
type AiMscoaAccountingBasis = 'accrual' | 'cash' | 'dual';
|
|
1074
|
+
/**
|
|
1075
|
+
* @public
|
|
1076
|
+
*
|
|
1077
|
+
* One segment of the chart of accounts this deployment publishes.
|
|
1078
|
+
*/
|
|
1079
|
+
interface AiMscoaSegmentDescriptor {
|
|
1080
|
+
/**
|
|
1081
|
+
* The segment key exactly as the chart of accounts spells it, upper case —
|
|
1082
|
+
* `ITEM`, `FUNCTION`, `FUND`, `PROJECT`, `REGION`. This is the value written
|
|
1083
|
+
* to `IIncludedSegmentConfig.segment`, and it must match a key the loaded
|
|
1084
|
+
* account tree actually carries: a segment nothing publishes renders nothing.
|
|
1085
|
+
*/
|
|
1086
|
+
readonly segment: string;
|
|
1087
|
+
/**
|
|
1088
|
+
* Heading shown above this segment's row, in title case. When omitted the
|
|
1089
|
+
* model writes one from the segment key and the form's own subject matter.
|
|
1090
|
+
*/
|
|
1091
|
+
readonly label?: string;
|
|
1092
|
+
/**
|
|
1093
|
+
* What this segment classifies, in one sentence. Optional, and the member
|
|
1094
|
+
* that most improves the result: it is what lets a model choose FUNCTION over
|
|
1095
|
+
* PROJECT on meaning rather than on the order of the list.
|
|
1096
|
+
*/
|
|
1097
|
+
readonly description?: string;
|
|
1098
|
+
/**
|
|
1099
|
+
* Whether the model may put this segment on a generated control. Defaults to
|
|
1100
|
+
* `true`. Set `false` for a segment that exists in the tree but is derived,
|
|
1101
|
+
* deprecated or reserved — it stays documented here without being offered.
|
|
1102
|
+
*/
|
|
1103
|
+
readonly selectable?: boolean;
|
|
1104
|
+
}
|
|
1105
|
+
/**
|
|
1106
|
+
* @public
|
|
1107
|
+
*
|
|
1108
|
+
* Chart-of-accounts grounding for the MSCOA specialist, installed with
|
|
1109
|
+
* {@link withAiMscoaGrounding}.
|
|
1110
|
+
*
|
|
1111
|
+
* Bound to {@link AI_MSCOA_GROUNDING}. Unbound, the specialist never activates
|
|
1112
|
+
* and the pipeline does not offer an `mscoaSelection` element — graceful
|
|
1113
|
+
* degradation, not a failure.
|
|
1114
|
+
*/
|
|
1115
|
+
interface AiMscoaGrounding {
|
|
1116
|
+
/**
|
|
1117
|
+
* The segments this deployment publishes, in the order they should normally
|
|
1118
|
+
* appear on a control. Required, and the reason the type exists: an empty
|
|
1119
|
+
* list grounds nothing, so the specialist treats it exactly as an unbound
|
|
1120
|
+
* token.
|
|
1121
|
+
*/
|
|
1122
|
+
readonly segments: readonly AiMscoaSegmentDescriptor[];
|
|
1123
|
+
/**
|
|
1124
|
+
* The accounting basis a generated control should capture unless the brief
|
|
1125
|
+
* says otherwise. Written to `IScoaInputConfig.accountingBasis`. When omitted
|
|
1126
|
+
* the model decides from the brief, which is right for a form that states its
|
|
1127
|
+
* basis and a coin toss for one that does not.
|
|
1128
|
+
*/
|
|
1129
|
+
readonly defaultAccountingBasis?: AiMscoaAccountingBasis;
|
|
1130
|
+
/**
|
|
1131
|
+
* Which field of an account identifies it to a user here — one of the values
|
|
1132
|
+
* in `MSCOA_ACCOUNT_VALUE_LABEL_OPTIONS` (`'SCOAid'`, `'AccountNumber'`,
|
|
1133
|
+
* `'AccountNumberShortened'`, `'ShortDescription'`, …), written to
|
|
1134
|
+
* `IScoaInputConfig.accountValueLabel`.
|
|
1135
|
+
*
|
|
1136
|
+
* Typed `string` because that pool is a runtime option list with no literal
|
|
1137
|
+
* type to narrow to; the schema still enumerates it, so a wrong value is
|
|
1138
|
+
* caught at generation. Worth setting: which one an administrator reads back
|
|
1139
|
+
* is a house convention, not something recoverable from the field names.
|
|
1140
|
+
*/
|
|
1141
|
+
readonly defaultAccountValueLabel?: string;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
/**
|
|
1145
|
+
* @public
|
|
1146
|
+
*
|
|
1147
|
+
* Grounds the AI form-builder's MSCOA specialist on **the chart of accounts
|
|
1148
|
+
* this deployment actually publishes**. Binds the supplied metadata to
|
|
1149
|
+
* {@link AI_MSCOA_GROUNDING}.
|
|
1150
|
+
*
|
|
1151
|
+
* The generation schema already constrains everything else about an
|
|
1152
|
+
* `mscoaSelection` control; the one fact it cannot supply is which segment keys
|
|
1153
|
+
* exist. Asked without grounding, a model writes `ITEM`, `FUNCTION`, `FUND` —
|
|
1154
|
+
* right for most municipalities, quietly wrong for one that publishes a
|
|
1155
|
+
* different set, and impossible to spot by reading the output.
|
|
1156
|
+
*
|
|
1157
|
+
* Without this feature the token stays unbound, the specialist never activates,
|
|
1158
|
+
* and no `mscoaSelection` element is offered at all. Graceful degradation, not
|
|
1159
|
+
* a failure.
|
|
1160
|
+
*
|
|
1161
|
+
* This is hand-written authoring-time metadata. It carries no account tree —
|
|
1162
|
+
* that stays behind `MSCOA_TREE_PROVIDER` at runtime — and reads nothing from
|
|
1163
|
+
* `IStoreFunctions`, which is why the shared typings interface needs no
|
|
1164
|
+
* widening to support the feature.
|
|
1165
|
+
*
|
|
1166
|
+
* Composes with {@link withAiFormBuilder} and {@link withAiEndpointCatalog};
|
|
1167
|
+
* order is irrelevant, and this feature binds nothing but its own token.
|
|
1168
|
+
*
|
|
1169
|
+
* @param grounding - The published segments, plus the deployment's defaults.
|
|
1170
|
+
* @returns The feature, for `provideNgxTForms(...)`.
|
|
1171
|
+
*
|
|
1172
|
+
* @example
|
|
1173
|
+
* bootstrapApplication(AppComponent, {
|
|
1174
|
+
* providers: [
|
|
1175
|
+
* provideNgxTForms(
|
|
1176
|
+
* config,
|
|
1177
|
+
* withAiFormBuilder({ models: { planning: 'my-planning-model' } }),
|
|
1178
|
+
* withAiMscoaGrounding({
|
|
1179
|
+
* segments: [
|
|
1180
|
+
* { segment: 'ITEM', label: 'Item', description: 'What is being bought or earned.' },
|
|
1181
|
+
* { segment: 'FUNCTION', label: 'Function' },
|
|
1182
|
+
* { segment: 'PROJECT', label: 'Project', selectable: false },
|
|
1183
|
+
* ],
|
|
1184
|
+
* defaultAccountingBasis: 'dual',
|
|
1185
|
+
* defaultAccountValueLabel: 'AccountNumberShortened',
|
|
1186
|
+
* }),
|
|
1187
|
+
* ),
|
|
1188
|
+
* ],
|
|
1189
|
+
* });
|
|
1190
|
+
*/
|
|
1191
|
+
declare function withAiMscoaGrounding(grounding: AiMscoaGrounding): NgxTFormsFeature;
|
|
1192
|
+
|
|
128
1193
|
/**
|
|
129
1194
|
* Provides the action handlers (submit, save, cancel, etc.) that the forms
|
|
130
1195
|
* runtime invokes when the user interacts with form controls. Bound from the
|
|
@@ -677,6 +1742,150 @@ declare abstract class FormSuggestionRegistry {
|
|
|
677
1742
|
*/
|
|
678
1743
|
declare const FORM_SUGGESTION_REGISTRY: InjectionToken<FormSuggestionRegistry>;
|
|
679
1744
|
|
|
1745
|
+
/**
|
|
1746
|
+
* @file The abstract **form-draft orchestrator** port — the injection-token
|
|
1747
|
+
* surface a consumer (or the shipped panel) uses to drive the AI drafting
|
|
1748
|
+
* pipeline and read back a staged form.
|
|
1749
|
+
*
|
|
1750
|
+
* It mirrors the library's established port pattern (see
|
|
1751
|
+
* {@link FormSuggestionRegistry} and `PipelineRepository`): an abstract class in
|
|
1752
|
+
* `domain/`, bound to a token in `tokens/`, and wired to a concrete
|
|
1753
|
+
* implementation by a `with*()` feature in `config/`. Consumers inject the
|
|
1754
|
+
* {@link FORM_DRAFT_ORCHESTRATOR} token, never a concrete class.
|
|
1755
|
+
*
|
|
1756
|
+
* The orchestrator is a **staging** surface, not a persistence one: it produces
|
|
1757
|
+
* a `FormInterface` on its session state and stops. Only the human saves, via
|
|
1758
|
+
* the existing form-builder save path (AI_FORM_BUILDER_DESIGN.md §5, guarantee 1).
|
|
1759
|
+
*/
|
|
1760
|
+
|
|
1761
|
+
/**
|
|
1762
|
+
* @public
|
|
1763
|
+
*
|
|
1764
|
+
* Port driving the Understand → Plan → Generate → Assemble → Verify pipeline
|
|
1765
|
+
* that turns a natural-language brief into a validated `FormInterface`.
|
|
1766
|
+
* Bound to {@link FORM_DRAFT_ORCHESTRATOR} by {@link withAiFormBuilder}.
|
|
1767
|
+
*
|
|
1768
|
+
* One instance owns at most one live session. Call {@link reset} to discard the
|
|
1769
|
+
* current session and release the underlying model resources.
|
|
1770
|
+
*
|
|
1771
|
+
* @example
|
|
1772
|
+
* // In a consumer component hosting the drafting UI:
|
|
1773
|
+
* readonly #orchestrator = inject(FORM_DRAFT_ORCHESTRATOR);
|
|
1774
|
+
* protected readonly session = this.#orchestrator.session;
|
|
1775
|
+
*
|
|
1776
|
+
* describe(text: string): void {
|
|
1777
|
+
* this.#orchestrator.describe(text);
|
|
1778
|
+
* }
|
|
1779
|
+
*
|
|
1780
|
+
* build(): void {
|
|
1781
|
+
* this.#orchestrator.generate()
|
|
1782
|
+
* .pipe(takeUntilDestroyed(this.#destroyRef))
|
|
1783
|
+
* .subscribe(session => {
|
|
1784
|
+
* if (session.form) this.stageOnCanvas(session.form);
|
|
1785
|
+
* });
|
|
1786
|
+
* }
|
|
1787
|
+
*/
|
|
1788
|
+
declare abstract class FormDraftOrchestrator {
|
|
1789
|
+
/**
|
|
1790
|
+
* Reactive snapshot of the current drafting session. Republished on every
|
|
1791
|
+
* stage transition, so a template can render progress without subscribing.
|
|
1792
|
+
*/
|
|
1793
|
+
abstract readonly session: Signal<DraftSession>;
|
|
1794
|
+
/**
|
|
1795
|
+
* Sends one turn of natural-language intake to the Analyst.
|
|
1796
|
+
*
|
|
1797
|
+
* Safe to call repeatedly: each call appends to the conversation and yields a
|
|
1798
|
+
* refreshed `brief` on the session once the Analyst responds. Answering the
|
|
1799
|
+
* Analyst's `openQuestions` is done with this same method.
|
|
1800
|
+
*
|
|
1801
|
+
* Pass `options.baseline` — the form on the canvas — to put the session in
|
|
1802
|
+
* **update mode**, where the conversation describes changes to that form
|
|
1803
|
+
* rather than a new form. The baseline stays on the session until `reset()`;
|
|
1804
|
+
* later turns need not repeat it. See {@link DescribeOptions}.
|
|
1805
|
+
*
|
|
1806
|
+
* @param message - What the user typed.
|
|
1807
|
+
* @param options - Optional: the saved form this turn is about changing.
|
|
1808
|
+
*/
|
|
1809
|
+
abstract describe(message: string, options?: DescribeOptions): void;
|
|
1810
|
+
/**
|
|
1811
|
+
* Runs the plan → generate → assemble → verify pipeline against the current
|
|
1812
|
+
* brief, including any routed repair turns the budget allows.
|
|
1813
|
+
*
|
|
1814
|
+
* The returned observable is cold: nothing runs until it is subscribed, and
|
|
1815
|
+
* unsubscribing cancels the run. It emits the terminal session — `staged`
|
|
1816
|
+
* when a form passed verification, `failed` otherwise — and completes.
|
|
1817
|
+
* Budget exhaustion is **not** an error: the session is emitted with the
|
|
1818
|
+
* outstanding {@link DraftFinding}s attached so a human can decide.
|
|
1819
|
+
*
|
|
1820
|
+
* @returns The terminal session for this run.
|
|
1821
|
+
*/
|
|
1822
|
+
abstract generate(): Observable<DraftSession>;
|
|
1823
|
+
/**
|
|
1824
|
+
* Discards the current session, releases the underlying model resources, and
|
|
1825
|
+
* returns the orchestrator to the `idle` stage.
|
|
1826
|
+
*/
|
|
1827
|
+
abstract reset(): void;
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1830
|
+
/**
|
|
1831
|
+
* @public
|
|
1832
|
+
*
|
|
1833
|
+
* Token binding the {@link FormDraftOrchestrator} port — the surface external
|
|
1834
|
+
* systems use to drive the AI form-builder draft panel and orchestrate form
|
|
1835
|
+
* creation workflows. Bound to the default {@link HashbrownFormDraftOrchestratorService} by
|
|
1836
|
+
* {@link withAiFormBuilder}; consumers may substitute their own implementation
|
|
1837
|
+
* by binding `useClass` (or `useValue` for a mock) against this token instead.
|
|
1838
|
+
*
|
|
1839
|
+
* Unbound by default — the AI form-builder layer is opt-in and fully tree-shakeable.
|
|
1840
|
+
* Nothing reachable from `provideNgxTForms()` references the orchestrator, so a
|
|
1841
|
+
* consumer who never installs the feature pays nothing for it. The shipped
|
|
1842
|
+
* `<t-form-draft-panel>` is presentational and injects nothing; the host reads
|
|
1843
|
+
* this token and wires the panel's inputs and outputs to it.
|
|
1844
|
+
*/
|
|
1845
|
+
declare const FORM_DRAFT_ORCHESTRATOR: InjectionToken<FormDraftOrchestrator>;
|
|
1846
|
+
|
|
1847
|
+
/**
|
|
1848
|
+
* @public
|
|
1849
|
+
*
|
|
1850
|
+
* Token binding the resolved configuration for the AI form-builder feature.
|
|
1851
|
+
* Supplied as the argument to {@link withAiFormBuilder}; the feature function
|
|
1852
|
+
* binds this token to the config object passed by the consumer.
|
|
1853
|
+
*
|
|
1854
|
+
* Unbound by default — available only when the AI form-builder feature is
|
|
1855
|
+
* installed via `withAiFormBuilder(config)`.
|
|
1856
|
+
*/
|
|
1857
|
+
declare const AI_FORM_BUILDER_CONFIG: InjectionToken<AiFormBuilderConfig>;
|
|
1858
|
+
|
|
1859
|
+
/**
|
|
1860
|
+
* @public
|
|
1861
|
+
*
|
|
1862
|
+
* Token binding the endpoint catalog the AI form-builder grounds itself on.
|
|
1863
|
+
*
|
|
1864
|
+
* Always bound to a provider function, never to a raw array:
|
|
1865
|
+
* {@link withAiEndpointCatalog} normalises the array form into one, so every
|
|
1866
|
+
* reader asks for entries the same way. Mirrors {@link MSCOA_TREE_PROVIDER}.
|
|
1867
|
+
*
|
|
1868
|
+
* Unbound by default — grounding is opt-in. With this token unbound the
|
|
1869
|
+
* pipeline never offers the `api` data-source branch or a submission endpoint,
|
|
1870
|
+
* and a draft simply comes back with none selected. That is the safe state: the
|
|
1871
|
+
* alternative to a real endpoint is an invented one.
|
|
1872
|
+
*/
|
|
1873
|
+
declare const AI_ENDPOINT_CATALOG: InjectionToken<AiEndpointCatalogProvider>;
|
|
1874
|
+
|
|
1875
|
+
/**
|
|
1876
|
+
* @public
|
|
1877
|
+
*
|
|
1878
|
+
* Token binding the municipal chart-of-accounts grounding for the AI
|
|
1879
|
+
* form-builder's MSCOA specialist. Supplied as the argument to
|
|
1880
|
+
* {@link withAiMscoaGrounding}.
|
|
1881
|
+
*
|
|
1882
|
+
* Unbound by default — grounding is opt-in, and the orchestrator injects it
|
|
1883
|
+
* `{ optional: true }`. With this token unbound the MSCOA specialist never
|
|
1884
|
+
* activates and no `mscoaSelection` element is offered, rather than one being
|
|
1885
|
+
* authored against segment keys the chart of accounts does not publish.
|
|
1886
|
+
*/
|
|
1887
|
+
declare const AI_MSCOA_GROUNDING: InjectionToken<AiMscoaGrounding>;
|
|
1888
|
+
|
|
680
1889
|
/**
|
|
681
1890
|
* @public
|
|
682
1891
|
*
|
|
@@ -726,6 +1935,38 @@ declare class FormSuggestionRegistryService extends FormSuggestionRegistry {
|
|
|
726
1935
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<FormSuggestionRegistryService>;
|
|
727
1936
|
}
|
|
728
1937
|
|
|
1938
|
+
/**
|
|
1939
|
+
* @public
|
|
1940
|
+
*
|
|
1941
|
+
* Default {@link FormDraftOrchestrator}, driving the
|
|
1942
|
+
* Understand → Plan → Generate → Specialise → Assemble → Verify pipeline over a
|
|
1943
|
+
* {@link DraftTransport}.
|
|
1944
|
+
*
|
|
1945
|
+
* Bound to {@link FORM_DRAFT_ORCHESTRATOR} by `withAiFormBuilder()`. The class is
|
|
1946
|
+
* exported so it can be referenced in a custom provider; consumers inject the
|
|
1947
|
+
* token, never this class.
|
|
1948
|
+
*/
|
|
1949
|
+
declare class HashbrownFormDraftOrchestratorService extends FormDraftOrchestrator {
|
|
1950
|
+
#private;
|
|
1951
|
+
/** Reactive snapshot of the current drafting session. */
|
|
1952
|
+
readonly session: _angular_core.Signal<DraftSession>;
|
|
1953
|
+
constructor();
|
|
1954
|
+
/**
|
|
1955
|
+
* Sends one turn of natural-language intake to the Analyst.
|
|
1956
|
+
*
|
|
1957
|
+
* With `options.baseline` the session enters update mode — the form is kept
|
|
1958
|
+
* on the session and every later turn and run is about changing it — until
|
|
1959
|
+
* `reset()`.
|
|
1960
|
+
*/
|
|
1961
|
+
describe(message: string, options?: DescribeOptions): void;
|
|
1962
|
+
/** Runs plan → generate → specialise → assemble → verify, including routed repair turns. */
|
|
1963
|
+
generate(): Observable<DraftSession>;
|
|
1964
|
+
/** Discards the session and releases every live model resource. */
|
|
1965
|
+
reset(): void;
|
|
1966
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<HashbrownFormDraftOrchestratorService, never>;
|
|
1967
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<HashbrownFormDraftOrchestratorService>;
|
|
1968
|
+
}
|
|
1969
|
+
|
|
729
1970
|
/**
|
|
730
1971
|
* @file Builds a Hashbrown **Skillet** schema (`@hashbrownai/core`) from a live
|
|
731
1972
|
* {@link FormSuggestionSnapshot}, so an LLM's structured output is constrained to
|
|
@@ -783,6 +2024,120 @@ declare function buildSuggestionSchema(snapshot: FormSuggestionSnapshot, options
|
|
|
783
2024
|
*/
|
|
784
2025
|
declare function toSuggestionBatch(formId: string | undefined, source: string, output: Record<string, unknown>): SuggestionBatch;
|
|
785
2026
|
|
|
2027
|
+
/**
|
|
2028
|
+
* @file Builds a Hashbrown **Skillet** schema (`@hashbrownai/core`) describing a
|
|
2029
|
+
* {@link FormBrief} — the Analyst's structured intake — so the intake turn's
|
|
2030
|
+
* structured output is constrained to the pipeline's own conversation/planning
|
|
2031
|
+
* shape.
|
|
2032
|
+
*
|
|
2033
|
+
* This schema describes a **pipeline artifact**, not the form model: it never
|
|
2034
|
+
* carries an element type, a validator, or anything else that belongs to
|
|
2035
|
+
* `ngx-t-forms-types/skillet`, which remains the single generation contract for
|
|
2036
|
+
* the form itself (AI_FORM_BUILDER_DESIGN.md §7).
|
|
2037
|
+
*
|
|
2038
|
+
* `@hashbrownai/core` is a **peer dependency** — the consuming app owns and
|
|
2039
|
+
* installs it; importing this builder is what pulls it in.
|
|
2040
|
+
*/
|
|
2041
|
+
|
|
2042
|
+
/**
|
|
2043
|
+
* Builds a Skillet schema describing a {@link FormBrief} — the Analyst's
|
|
2044
|
+
* structured intake (proposed title, summary, inferred field intents, a
|
|
2045
|
+
* numbered business-rules ledger, and open questions for the user). Feed the
|
|
2046
|
+
* result to a Hashbrown structured-output API for the intake turn; the pipeline
|
|
2047
|
+
* never uses this schema to describe the generated form itself — that is
|
|
2048
|
+
* `ngx-t-forms-types/skillet`'s job alone.
|
|
2049
|
+
*
|
|
2050
|
+
* @param options - `streaming: true` builds a streamable schema
|
|
2051
|
+
* (`s.streaming.object` at the root, `s.streaming.array` for `fields`, `rules`
|
|
2052
|
+
* and `openQuestions`) so the panel can render the brief as it arrives.
|
|
2053
|
+
* Otherwise every node uses the non-streaming builders.
|
|
2054
|
+
* @returns A Skillet schema (`s.object` / `s.streaming.object`) for a {@link FormBrief}.
|
|
2055
|
+
*
|
|
2056
|
+
* @example
|
|
2057
|
+
* const schema = buildBriefSchema({ streaming: true });
|
|
2058
|
+
* const result = structuredCompletionResource({ model, input, schema });
|
|
2059
|
+
* // result.value() narrows towards a FormBrief shape as tokens stream in.
|
|
2060
|
+
*/
|
|
2061
|
+
declare function buildBriefSchema(options?: {
|
|
2062
|
+
streaming?: boolean;
|
|
2063
|
+
}): s.HashbrownType;
|
|
2064
|
+
|
|
2065
|
+
/**
|
|
2066
|
+
* @file Builds a Hashbrown **Skillet** schema (`@hashbrownai/core`) describing a
|
|
2067
|
+
* {@link FormBlueprint} — the Architect's slide/field-stub plan — so the
|
|
2068
|
+
* planning turn's structured output is constrained to the pipeline's own plan
|
|
2069
|
+
* shape and to a caller-supplied element union.
|
|
2070
|
+
*
|
|
2071
|
+
* This schema describes a **pipeline artifact**, not the form model: a field
|
|
2072
|
+
* stub carries only an {@link ElementTypes} pick, rule-tag references and the
|
|
2073
|
+
* specialist flags below — never a validator, an endpoint or anything else that
|
|
2074
|
+
* belongs to `ngx-t-forms-types/skillet`, which remains the single generation
|
|
2075
|
+
* contract for the form itself (AI_FORM_BUILDER_DESIGN.md §7).
|
|
2076
|
+
*
|
|
2077
|
+
* ## Why the specialist flags are conditional
|
|
2078
|
+
*
|
|
2079
|
+
* Phase 2 adds three grounded specialists, and the Architect is the agent that
|
|
2080
|
+
* decides which fields need one. Each flag is therefore offered **only when the
|
|
2081
|
+
* pipeline can honour it**: `needsDataSource` needs an endpoint catalog to point
|
|
2082
|
+
* at, `needsMscoa` needs chart-of-accounts grounding. Showing a model a choice
|
|
2083
|
+
* the library cannot act on is the same failure as asking it for a URL — it
|
|
2084
|
+
* answers confidently, and the answer goes nowhere.
|
|
2085
|
+
*
|
|
2086
|
+
* With every option left off, this builder emits exactly the Phase 1 schema.
|
|
2087
|
+
*
|
|
2088
|
+
* `@hashbrownai/core` is a **peer dependency** — the consuming app owns and
|
|
2089
|
+
* installs it; importing this builder is what pulls it in.
|
|
2090
|
+
*/
|
|
2091
|
+
|
|
2092
|
+
/**
|
|
2093
|
+
* Which specialist flags the field-stub schema offers, which endpoints the form
|
|
2094
|
+
* may be submitted to, and whether the schema streams. Declared inline on
|
|
2095
|
+
* {@link buildBlueprintSchema} rather than as an exported interface, so the
|
|
2096
|
+
* public surface gains no name that consumers do not need.
|
|
2097
|
+
*/
|
|
2098
|
+
interface BlueprintSchemaOptions {
|
|
2099
|
+
readonly streaming?: boolean;
|
|
2100
|
+
readonly dataSourceGrounding?: boolean;
|
|
2101
|
+
readonly mscoaGrounding?: boolean;
|
|
2102
|
+
readonly logic?: boolean;
|
|
2103
|
+
readonly submissionEndpoints?: readonly AvailableApiEndpoint[];
|
|
2104
|
+
readonly canSubmitEndpoints?: readonly AvailableApiEndpoint[];
|
|
2105
|
+
/**
|
|
2106
|
+
* Update mode: the plan revises a saved form, so the schema offers
|
|
2107
|
+
* `removedFields` — the one thing a revision must be able to say that a plan
|
|
2108
|
+
* from nothing never needs to.
|
|
2109
|
+
*/
|
|
2110
|
+
readonly update?: boolean;
|
|
2111
|
+
}
|
|
2112
|
+
/**
|
|
2113
|
+
* Builds a Skillet schema describing a {@link FormBlueprint} — the plan of
|
|
2114
|
+
* slides and field stubs produced before the expensive per-column generation
|
|
2115
|
+
* step, so it is cheap to re-run. Each field stub's `element` is constrained to
|
|
2116
|
+
* `elements`, so the model can only pick a legal element.
|
|
2117
|
+
*
|
|
2118
|
+
* @param elements - The element union this pipeline is configured to offer.
|
|
2119
|
+
* Rendered as an `s.enumeration` so the model cannot pick outside the set the
|
|
2120
|
+
* consumer's Field Generator is prepared to expand.
|
|
2121
|
+
* @param options - `streaming: true` builds a streamable schema
|
|
2122
|
+
* (`s.streaming.object` at the root, `s.streaming.array` for `slides`) so the
|
|
2123
|
+
* panel can render the plan as it arrives. Otherwise every node uses the
|
|
2124
|
+
* non-streaming builders.
|
|
2125
|
+
*
|
|
2126
|
+
* `dataSourceGrounding`, `mscoaGrounding` and `logic` each add one specialist
|
|
2127
|
+
* flag to the field stub, and are set by the orchestrator only when the
|
|
2128
|
+
* corresponding specialist can actually run. `submissionEndpoints` and
|
|
2129
|
+
* `canSubmitEndpoints` add the two form-level endpoint choices, each set only
|
|
2130
|
+
* when a bound catalog declares an endpoint for that slot. All five default to
|
|
2131
|
+
* off, which reproduces the Phase 1 schema exactly.
|
|
2132
|
+
* @returns A Skillet schema (`s.object` / `s.streaming.object`) for a {@link FormBlueprint}.
|
|
2133
|
+
*
|
|
2134
|
+
* @example
|
|
2135
|
+
* const schema = buildBlueprintSchema(config.elements ?? COMMON_ELEMENTS, { streaming: true });
|
|
2136
|
+
* const result = structuredCompletionResource({ model, input, schema });
|
|
2137
|
+
* // result.value() narrows towards a FormBlueprint shape as tokens stream in.
|
|
2138
|
+
*/
|
|
2139
|
+
declare function buildBlueprintSchema(elements: readonly ElementTypes[], options?: BlueprintSchemaOptions): s.HashbrownType;
|
|
2140
|
+
|
|
786
2141
|
/**
|
|
787
2142
|
* Renders the list of forms a user can open, edit, or build, with search,
|
|
788
2143
|
* grouping (system vs custom), and section switching (active / archived /
|
|
@@ -885,11 +2240,59 @@ declare class FormBuilderComponent {
|
|
|
885
2240
|
/** Whether an input editor panel is currently open. */
|
|
886
2241
|
readonly elementEditorOpen: _angular_core.Signal<boolean>;
|
|
887
2242
|
pendingExternalRefresh: _angular_core.Signal<{
|
|
888
|
-
form:
|
|
2243
|
+
form: FormInterface;
|
|
889
2244
|
timestamp: Date;
|
|
890
2245
|
} | null>;
|
|
891
2246
|
refreshCountdown: _angular_core.WritableSignal<number>;
|
|
892
2247
|
constructor();
|
|
2248
|
+
/**
|
|
2249
|
+
* Loads an already-validated form definition into this canvas as an unsaved
|
|
2250
|
+
* working form.
|
|
2251
|
+
*
|
|
2252
|
+
* The staging half of the AI form-builder contract: the drafting pipeline
|
|
2253
|
+
* produces a `FormInterface`, and a human saves it — nothing is persisted
|
|
2254
|
+
* here. The draft enters through the same store path a database-loaded form
|
|
2255
|
+
* takes, so once it lands it is indistinguishable from an opened unsaved
|
|
2256
|
+
* form: same selectors, same editor, same save flow.
|
|
2257
|
+
*
|
|
2258
|
+
* This component knows nothing about the AI layer — the argument is an
|
|
2259
|
+
* ordinary `FormInterface`, so nothing here imports, or pulls in, the
|
|
2260
|
+
* drafting code. A host that never drafts pays nothing for this method.
|
|
2261
|
+
*
|
|
2262
|
+
* By default any `formId` on the incoming form is discarded: a staged draft
|
|
2263
|
+
* is a new form, so saving it creates rather than overwrites. With
|
|
2264
|
+
* `options.mode: 'update'` the draft is applied to the form that is open
|
|
2265
|
+
* instead — it keeps that form's identity, so Save updates it — which is how
|
|
2266
|
+
* a result of the AI form builder's update mode (a draft built from the open
|
|
2267
|
+
* form as its baseline, see {@link currentForm}) is put back. When nothing
|
|
2268
|
+
* saved is open, `'update'` behaves as `'replace'`.
|
|
2269
|
+
*
|
|
2270
|
+
* @param form - The definition to stage. Expected to have passed the same Joi
|
|
2271
|
+
* validation a stored form passes; the canvas is not a validator.
|
|
2272
|
+
* @param options - `mode: 'update'` to apply the draft to the open form.
|
|
2273
|
+
*
|
|
2274
|
+
* @example
|
|
2275
|
+
* readonly #canvas = viewChild.required(FormBuilderComponent);
|
|
2276
|
+
* stage(form: FormInterface): void {
|
|
2277
|
+
* this.#canvas().stageGeneratedDraft(form);
|
|
2278
|
+
* }
|
|
2279
|
+
*/
|
|
2280
|
+
stageGeneratedDraft(form: FormInterface, options?: {
|
|
2281
|
+
readonly mode?: 'replace' | 'update';
|
|
2282
|
+
}): void;
|
|
2283
|
+
/**
|
|
2284
|
+
* The form as the canvas currently holds it — saved or not — or `undefined`
|
|
2285
|
+
* when none is loaded.
|
|
2286
|
+
*
|
|
2287
|
+
* The host hands this to the AI form builder as the **baseline** of an
|
|
2288
|
+
* update (`FormDraftOrchestrator.describe(text, { baseline })`), and hands
|
|
2289
|
+
* the staged result back through {@link stageGeneratedDraft} with
|
|
2290
|
+
* `mode: 'update'`. A snapshot, not a live reference: editing the returned
|
|
2291
|
+
* object changes nothing on the canvas.
|
|
2292
|
+
*
|
|
2293
|
+
* @returns A structural copy of the form in edit, or `undefined`.
|
|
2294
|
+
*/
|
|
2295
|
+
currentForm(): FormInterface | undefined;
|
|
893
2296
|
triggerRefreshNow(): void;
|
|
894
2297
|
readonly NGX_T_FORMS_CONFIG: ngx_t_forms_types.NgxTFormsConfig;
|
|
895
2298
|
readonly closeButton: ngx_t_forms_types.ActionButton;
|
|
@@ -1285,6 +2688,11 @@ declare abstract class FormTowerControllerService implements OnDestroy {
|
|
|
1285
2688
|
*
|
|
1286
2689
|
* - **Sourced inputs** (InputSourcedValue) → routes to the entry's writable
|
|
1287
2690
|
* `linkedSignal.set(value)` (transient override; reset on next source change).
|
|
2691
|
+
* EXCEPT a merge-mode input ({@link mergesDerivedValue}): that entry is the
|
|
2692
|
+
* TOWER's channel, and the fold reads it to know what the tower says. Writing
|
|
2693
|
+
* the user's completion into it would make the merge diff the user's own
|
|
2694
|
+
* value against itself and lose the completion on the next source change —
|
|
2695
|
+
* so those go to `#model`, where the fold expects to find them.
|
|
1288
2696
|
* - **All other inputs** → writes `#model[inputId]`.
|
|
1289
2697
|
*
|
|
1290
2698
|
* A **MultipleInput** row array is passed through
|
|
@@ -2027,6 +3435,347 @@ declare class TSuggestionReviewComponent {
|
|
|
2027
3435
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TSuggestionReviewComponent, "t-suggestion-review", never, { "suggestions": { "alias": "suggestions"; "required": true; "isSignal": true; }; "schema": { "alias": "schema"; "required": true; "isSignal": true; }; "previewValue": { "alias": "previewValue"; "required": false; "isSignal": true; }; }, { "accept": "accept"; "reject": "reject"; "acceptAll": "acceptAll"; "rejectAll": "rejectAll"; }, never, never, true, never>;
|
|
2028
3436
|
}
|
|
2029
3437
|
|
|
3438
|
+
/** One repair-log entry, reduced to the lines the panel draws. */
|
|
3439
|
+
interface RepairTurnView {
|
|
3440
|
+
readonly sequence: number;
|
|
3441
|
+
readonly kind: DraftRepairTurnKind;
|
|
3442
|
+
readonly kindLabel: string;
|
|
3443
|
+
/** Where the work went, as one sentence. */
|
|
3444
|
+
readonly route: string;
|
|
3445
|
+
/** The targets the turn addressed. */
|
|
3446
|
+
readonly findings: readonly string[];
|
|
3447
|
+
/** What the next verification found, or `undefined` while it has not run. */
|
|
3448
|
+
readonly outcome?: string;
|
|
3449
|
+
}
|
|
3450
|
+
/** One planned field stub, reduced to what the panel draws. */
|
|
3451
|
+
interface PlannedFieldView {
|
|
3452
|
+
/** Visible label, or a positional stand-in while none has streamed in. */
|
|
3453
|
+
readonly label: string;
|
|
3454
|
+
/** Element type, or `''` while none has streamed in. */
|
|
3455
|
+
readonly element: string;
|
|
3456
|
+
}
|
|
3457
|
+
/** One planned slide, reduced to what the panel draws. */
|
|
3458
|
+
interface PlannedSlideView {
|
|
3459
|
+
/** Slide heading, or a positional stand-in while none has streamed in. */
|
|
3460
|
+
readonly label: string;
|
|
3461
|
+
/** Field stubs planned for the slide. */
|
|
3462
|
+
readonly fields: readonly PlannedFieldView[];
|
|
3463
|
+
/** Whether this slide's columns are the ones streaming right now. */
|
|
3464
|
+
readonly generating: boolean;
|
|
3465
|
+
}
|
|
3466
|
+
/**
|
|
3467
|
+
* Renders one AI form-builder drafting session — the intake conversation, the
|
|
3468
|
+
* Analyst's brief, the Architect's blueprint as it streams in, rule-coverage
|
|
3469
|
+
* traceability, verification findings, the loop counters and what the run cost
|
|
3470
|
+
* — and lets the user describe the form, run generation, stage the result on
|
|
3471
|
+
* the canvas, or discard the session. It is **presentational only** — it holds
|
|
3472
|
+
* no orchestrator reference and mutates nothing beyond its own composer text;
|
|
3473
|
+
* the host wires its inputs to the orchestrator's session signal and its
|
|
3474
|
+
* outputs back to the orchestrator's `describe()` / `generate()` / `reset()`
|
|
3475
|
+
* methods, so a per-component pipeline is never pulled into this component's
|
|
3476
|
+
* injector.
|
|
3477
|
+
*
|
|
3478
|
+
* Every region below is a rendering of data already on {@link DraftSession}:
|
|
3479
|
+
* nothing here derives state the orchestrator does not publish, and a member
|
|
3480
|
+
* the session omits renders as an absent region rather than as a zero.
|
|
3481
|
+
*
|
|
3482
|
+
* The panel's four outputs are named for the user's intent (describe, build,
|
|
3483
|
+
* stage, discard); the port they map onto is `describe()`, `generate()`,
|
|
3484
|
+
* the host's own staging call, and `reset()`.
|
|
3485
|
+
*
|
|
3486
|
+
* `busy` is derived by the host, not read off the session: `stage` stays
|
|
3487
|
+
* `'intake'` after the Analyst answers, so it cannot drive a spinner on its own.
|
|
3488
|
+
*
|
|
3489
|
+
* @example
|
|
3490
|
+
* readonly #orchestrator = inject(FORM_DRAFT_ORCHESTRATOR);
|
|
3491
|
+
* readonly #canvas = viewChild.required(FormBuilderComponent);
|
|
3492
|
+
* protected readonly session = this.#orchestrator.session;
|
|
3493
|
+
* protected readonly building = signal(false);
|
|
3494
|
+
* protected readonly busy = computed(() => {
|
|
3495
|
+
* const s = this.session();
|
|
3496
|
+
* return this.building() ||
|
|
3497
|
+
* (s.stage === 'intake' && s.conversation.at(-1)?.author === 'user');
|
|
3498
|
+
* });
|
|
3499
|
+
*
|
|
3500
|
+
* protected build(): void {
|
|
3501
|
+
* this.building.set(true);
|
|
3502
|
+
* this.#orchestrator.generate()
|
|
3503
|
+
* .pipe(takeUntilDestroyed(this.#destroyRef))
|
|
3504
|
+
* .subscribe(() => this.building.set(false));
|
|
3505
|
+
* }
|
|
3506
|
+
*
|
|
3507
|
+
* <t-form-draft-panel
|
|
3508
|
+
* [session]="session()"
|
|
3509
|
+
* [busy]="busy()"
|
|
3510
|
+
* (describe)="orchestrator.describe($event)"
|
|
3511
|
+
* (build)="build()"
|
|
3512
|
+
* (stage)="canvas().stageGeneratedDraft($event)"
|
|
3513
|
+
* (discard)="orchestrator.reset()" />
|
|
3514
|
+
*/
|
|
3515
|
+
declare class TFormDraftPanelComponent {
|
|
3516
|
+
#private;
|
|
3517
|
+
/** The drafting session to render (typically `orchestrator.session()`). */
|
|
3518
|
+
readonly session: _angular_core.InputSignal<DraftSession>;
|
|
3519
|
+
/** Whether a pipeline turn is in flight; disables the composer and Build. */
|
|
3520
|
+
readonly busy: _angular_core.InputSignal<boolean>;
|
|
3521
|
+
/** Emits the natural-language message the user submitted from the composer. */
|
|
3522
|
+
readonly describe: _angular_core.OutputEmitterRef<string>;
|
|
3523
|
+
/** Emitted when the user asks the pipeline to run generation. */
|
|
3524
|
+
readonly build: _angular_core.OutputEmitterRef<void>;
|
|
3525
|
+
/** Emits the staged {@link FormInterface} when the user accepts it for the canvas. */
|
|
3526
|
+
readonly stage: _angular_core.OutputEmitterRef<FormInterface>;
|
|
3527
|
+
/** Emitted when the user discards the current session. */
|
|
3528
|
+
readonly discard: _angular_core.OutputEmitterRef<void>;
|
|
3529
|
+
/** The session's current lifecycle stage; also reflected on the host as `data-stage`. */
|
|
3530
|
+
protected readonly stageName: _angular_core.Signal<DraftStage>;
|
|
3531
|
+
/** Intake conversation so far. */
|
|
3532
|
+
protected readonly conversation: _angular_core.Signal<readonly DraftMessage[]>;
|
|
3533
|
+
/** The Analyst's latest brief, once produced. */
|
|
3534
|
+
protected readonly brief: _angular_core.Signal<FormBrief | undefined>;
|
|
3535
|
+
/** The Architect's latest blueprint, once produced. */
|
|
3536
|
+
protected readonly blueprint: _angular_core.Signal<FormBlueprint | undefined>;
|
|
3537
|
+
/**
|
|
3538
|
+
* The partial output of the turn in flight, when one is streaming.
|
|
3539
|
+
*
|
|
3540
|
+
* The panel's only progress signal, and read for nothing else: a partial is
|
|
3541
|
+
* never staged, never verified and never counted.
|
|
3542
|
+
*/
|
|
3543
|
+
protected readonly partial: _angular_core.Signal<DraftPartial | undefined>;
|
|
3544
|
+
/** All outstanding findings for the session. */
|
|
3545
|
+
protected readonly findings: _angular_core.Signal<readonly DraftFinding[]>;
|
|
3546
|
+
/**
|
|
3547
|
+
* Whether the ledger below is the verifier's verdict rather than the panel's.
|
|
3548
|
+
*
|
|
3549
|
+
* Rendered as provenance, because the two are not equally authoritative: the
|
|
3550
|
+
* verifier reads the assembled form, while the fallback reads the plan that
|
|
3551
|
+
* was *meant* to produce it and can therefore call a rule covered on the
|
|
3552
|
+
* strength of a tag whose field never survived generation.
|
|
3553
|
+
*
|
|
3554
|
+
* Two independent pieces of evidence, because neither is sufficient alone.
|
|
3555
|
+
*
|
|
3556
|
+
* A reported coverage gap is DIRECT evidence: only the verifier emits
|
|
3557
|
+
* `kind: 'coverage'`. But keying off gaps alone said "verification has not
|
|
3558
|
+
* reported on this draft yet" on exactly the runs where every rule was
|
|
3559
|
+
* covered — telling the user the opposite of the truth at the one moment the
|
|
3560
|
+
* draft was clean. So a post-verification stage counts too, which is what
|
|
3561
|
+
* covers the clean run that has nothing to report.
|
|
3562
|
+
*/
|
|
3563
|
+
protected readonly coverageFromVerifier: _angular_core.Signal<boolean>;
|
|
3564
|
+
/**
|
|
3565
|
+
* Traceability ledger: each brief rule paired with whether the draft covers
|
|
3566
|
+
* it, and with what the verifier's finding adds when it reported the gap.
|
|
3567
|
+
*
|
|
3568
|
+
* Prefers the verifier's `coverage` findings whenever the session carries
|
|
3569
|
+
* any, and falls back to matching brief rules against the blueprint's
|
|
3570
|
+
* `ruleTags` when it carries none — which is every moment before verification
|
|
3571
|
+
* has run, when the plan is the only evidence there is.
|
|
3572
|
+
*
|
|
3573
|
+
* `detail` is the finding's `suggestedFix` where it has one, and only falls
|
|
3574
|
+
* back to its `message`. The row already prints the rule id, the statement
|
|
3575
|
+
* and the verdict, so the message's own sentence — "Rule R9 is not covered …
|
|
3576
|
+
* Rule as stated: …" — is that row read back to the user. What the finding
|
|
3577
|
+
* knows and the ledger does not is what to *do* about the gap, so that is
|
|
3578
|
+
* what the row carries. See {@link listedFindings} for why the finding itself
|
|
3579
|
+
* is then not rendered a second time.
|
|
3580
|
+
*
|
|
3581
|
+
* An uncovered rule is advisory, never an error: it says the draft did not
|
|
3582
|
+
* trace to something the brief asked for, which is a thing for a human to
|
|
3583
|
+
* look at, not a thing that failed.
|
|
3584
|
+
*/
|
|
3585
|
+
protected readonly coverage: _angular_core.Signal<readonly {
|
|
3586
|
+
readonly rule: FormBriefRule;
|
|
3587
|
+
readonly covered: boolean;
|
|
3588
|
+
readonly detail?: string;
|
|
3589
|
+
}[]>;
|
|
3590
|
+
/**
|
|
3591
|
+
* The findings the general list renders.
|
|
3592
|
+
*
|
|
3593
|
+
* **The coverage ledger owns coverage.** A `coverage` finding and a ledger
|
|
3594
|
+
* row are one fact — *this rule was not traced to* — so rendering both put
|
|
3595
|
+
* the same uncovered rule on screen twice: once as an amber row, once as an
|
|
3596
|
+
* advisory finding a few sections below it. The ledger keeps it, because it
|
|
3597
|
+
* is the only surface that shows covered and uncovered together and can
|
|
3598
|
+
* therefore answer the question the finding cannot: how much of the brief the
|
|
3599
|
+
* draft did reach. The finding's own contribution, its remedy, moves onto the
|
|
3600
|
+
* row as that row's `detail` (see {@link coverage}), so nothing is lost by
|
|
3601
|
+
* withdrawing it from here.
|
|
3602
|
+
*
|
|
3603
|
+
* Only findings the ledger genuinely renders are withdrawn. A coverage
|
|
3604
|
+
* finding whose target is not a rule in the brief — an invented rule tag —
|
|
3605
|
+
* has no row to move to, so it stays in this list rather than vanishing from
|
|
3606
|
+
* the panel altogether.
|
|
3607
|
+
*
|
|
3608
|
+
* Do not restore coverage findings to this list: the duplicate is what this
|
|
3609
|
+
* filter exists to remove, and a coverage finding reappearing beneath the
|
|
3610
|
+
* ledger is the defect, not the fix.
|
|
3611
|
+
*/
|
|
3612
|
+
protected readonly listedFindings: _angular_core.Signal<readonly DraftFinding[]>;
|
|
3613
|
+
/** Listed findings that block acceptance — shown first, ahead of advisory ones. */
|
|
3614
|
+
protected readonly blockingFindings: _angular_core.Signal<readonly DraftFinding[]>;
|
|
3615
|
+
/** Listed findings that are informational only. */
|
|
3616
|
+
protected readonly advisoryFindings: _angular_core.Signal<readonly DraftFinding[]>;
|
|
3617
|
+
/**
|
|
3618
|
+
* Every listed finding in reading order — blocking first — each paired with
|
|
3619
|
+
* the display name of its kind, so one loop renders both dimensions.
|
|
3620
|
+
*/
|
|
3621
|
+
protected readonly orderedFindings: _angular_core.Signal<readonly {
|
|
3622
|
+
readonly finding: DraftFinding;
|
|
3623
|
+
readonly kindLabel: string;
|
|
3624
|
+
}[]>;
|
|
3625
|
+
/**
|
|
3626
|
+
* Listed findings tallied by kind, in reading order, skipping kinds this
|
|
3627
|
+
* session carries none of.
|
|
3628
|
+
*
|
|
3629
|
+
* Counts what the list below it shows, never the raw session: a tally reading
|
|
3630
|
+
* `Coverage — 2 advisory` above a list holding neither of them would be the
|
|
3631
|
+
* duplicate {@link listedFindings} removes, put back in summary form.
|
|
3632
|
+
*
|
|
3633
|
+
* Both counts travel together so the template can obey SC-06 (never two
|
|
3634
|
+
* differently-coloured semantic chips on one element): where a kind has
|
|
3635
|
+
* blocking entries they take the chip and the advisory count is plain text.
|
|
3636
|
+
*/
|
|
3637
|
+
protected readonly findingTally: _angular_core.Signal<readonly {
|
|
3638
|
+
readonly kind: DraftFindingKind;
|
|
3639
|
+
readonly label: string;
|
|
3640
|
+
readonly blocking: number;
|
|
3641
|
+
readonly advisory: number;
|
|
3642
|
+
}[]>;
|
|
3643
|
+
/**
|
|
3644
|
+
* Whether the plan on screen is still being written.
|
|
3645
|
+
*
|
|
3646
|
+
* Keyed off the live partial, and deliberately **not** off
|
|
3647
|
+
* `stage === 'planning' && blueprint !== undefined`: that pair is
|
|
3648
|
+
* unobservable. The orchestrator assigns the blueprint and moves to
|
|
3649
|
+
* `generating` in two consecutive statements with nothing awaited between
|
|
3650
|
+
* them, so the earliest snapshot any subscriber can sample already says
|
|
3651
|
+
* `generating` — the predicate was false at every instant a panel could read
|
|
3652
|
+
* it. `partial` is the one member that is true for the whole of the
|
|
3653
|
+
* Architect's turn and cleared outside it.
|
|
3654
|
+
*/
|
|
3655
|
+
protected readonly blueprintStreaming: _angular_core.Signal<boolean>;
|
|
3656
|
+
/**
|
|
3657
|
+
* Whether there is a plan region to render at all.
|
|
3658
|
+
*
|
|
3659
|
+
* True from the first architect partial, before any slide has streamed in, so
|
|
3660
|
+
* the "still being written" caption can appear where the plan is about to —
|
|
3661
|
+
* rather than the region popping into existence once it is half-built.
|
|
3662
|
+
*/
|
|
3663
|
+
protected readonly hasPlan: _angular_core.Signal<boolean>;
|
|
3664
|
+
/**
|
|
3665
|
+
* The slide whose columns are streaming right now, or `undefined`.
|
|
3666
|
+
*
|
|
3667
|
+
* Slides are generated in parallel and the session carries one partial at a
|
|
3668
|
+
* time, so this marks the slide the latest partial names — not every slide in
|
|
3669
|
+
* flight. Without `slideIndex` the two concurrent streams would be
|
|
3670
|
+
* indistinguishable and the mark would have to go on all of them or none.
|
|
3671
|
+
*/
|
|
3672
|
+
protected readonly generatingSlideIndex: _angular_core.Signal<number | undefined>;
|
|
3673
|
+
/**
|
|
3674
|
+
* The planned slides, rendered defensively so a half-written stream reads.
|
|
3675
|
+
*
|
|
3676
|
+
* Every member is read through the streaming guards above, because a partial
|
|
3677
|
+
* carries no guarantee that a sibling's presence implies its own: a slide can
|
|
3678
|
+
* arrive with fields and no label, with a `fields` array that is present and
|
|
3679
|
+
* empty, or with a field carrying nothing but a `formControlName`.
|
|
3680
|
+
*
|
|
3681
|
+
* Positional fallbacks (`Slide 2`, `Field 3`) stand in for members that have
|
|
3682
|
+
* not streamed in yet, so a row that is still arriving keeps its place in the
|
|
3683
|
+
* list instead of collapsing to blank space.
|
|
3684
|
+
*/
|
|
3685
|
+
protected readonly plannedSlides: _angular_core.Signal<readonly PlannedSlideView[]>;
|
|
3686
|
+
/**
|
|
3687
|
+
* The run's repair log, one row per turn, in order.
|
|
3688
|
+
*
|
|
3689
|
+
* This is the region that makes a repaired or failed run explain itself:
|
|
3690
|
+
* what each turn set out to fix, who was asked, what was withdrawn or
|
|
3691
|
+
* escalated, and whether the next verification bore it out. Empty for a run
|
|
3692
|
+
* that staged on the first pass, and for a session no run has repaired.
|
|
3693
|
+
*/
|
|
3694
|
+
protected readonly repairLog: _angular_core.Signal<readonly RepairTurnView[]>;
|
|
3695
|
+
/**
|
|
3696
|
+
* The title of the saved form this session is editing, when it is editing
|
|
3697
|
+
* one — the one line that tells the reader a build will change that form
|
|
3698
|
+
* rather than draft a new one.
|
|
3699
|
+
*/
|
|
3700
|
+
protected readonly baselineTitle: _angular_core.Signal<string | undefined>;
|
|
3701
|
+
/** Repair turns the inner loop has consumed. */
|
|
3702
|
+
protected readonly repairTurnsUsed: _angular_core.Signal<number>;
|
|
3703
|
+
/**
|
|
3704
|
+
* Critique rounds consumed, or `undefined` when the Critic never ran.
|
|
3705
|
+
*
|
|
3706
|
+
* Deliberately not collapsed with `?? 0`: here the difference is the whole
|
|
3707
|
+
* point of showing the number, so `undefined` renders as no row at all rather
|
|
3708
|
+
* than as a zero that would claim the outer loop ran and converged at once.
|
|
3709
|
+
*/
|
|
3710
|
+
protected readonly critiqueRoundsUsed: _angular_core.Signal<number | undefined>;
|
|
3711
|
+
/**
|
|
3712
|
+
* Whether the run staged a valid form the Critic still had observations
|
|
3713
|
+
* about. A normal, successful outcome — the form cleared every deterministic
|
|
3714
|
+
* gate — so it is rendered as something to read, never as a failure.
|
|
3715
|
+
*/
|
|
3716
|
+
protected readonly stagedWithOutstandingFindings: _angular_core.Signal<boolean>;
|
|
3717
|
+
/** Whether either loop has anything to report yet. */
|
|
3718
|
+
protected readonly showLoopLedger: _angular_core.Signal<boolean>;
|
|
3719
|
+
/** What the run has cost so far, once the orchestrator has counted anything. */
|
|
3720
|
+
protected readonly telemetry: _angular_core.Signal<DraftTelemetry | undefined>;
|
|
3721
|
+
/**
|
|
3722
|
+
* Calls per role, in pipeline order. A missing key means zero, so a role that
|
|
3723
|
+
* never ran carries no row.
|
|
3724
|
+
*/
|
|
3725
|
+
protected readonly callsByRole: _angular_core.Signal<readonly {
|
|
3726
|
+
readonly label: string;
|
|
3727
|
+
readonly calls: number;
|
|
3728
|
+
}[]>;
|
|
3729
|
+
/**
|
|
3730
|
+
* Calls per lifecycle stage, in lifecycle order — not a restatement of
|
|
3731
|
+
* {@link callsByRole}: a repair turn re-invokes the Generator and the
|
|
3732
|
+
* specialists, so `repairing` is what isolates the inner loop's cost, and
|
|
3733
|
+
* `critiquing` what isolates the outer loop's reviews from the re-plans they
|
|
3734
|
+
* trigger.
|
|
3735
|
+
*/
|
|
3736
|
+
protected readonly callsByStage: _angular_core.Signal<readonly {
|
|
3737
|
+
readonly label: string;
|
|
3738
|
+
readonly calls: number;
|
|
3739
|
+
}[]>;
|
|
3740
|
+
/** Whether the Build action is available: a brief exists and the pipeline is idle. */
|
|
3741
|
+
protected readonly canBuild: _angular_core.Signal<boolean>;
|
|
3742
|
+
/** Whether a verified form is staged and ready to accept onto the canvas. */
|
|
3743
|
+
protected readonly isStaged: _angular_core.Signal<boolean>;
|
|
3744
|
+
/**
|
|
3745
|
+
* The diagnostic record of the crash that ended the run, when one did.
|
|
3746
|
+
*
|
|
3747
|
+
* Present only when the run stopped on a *thrown* error. A run that stopped
|
|
3748
|
+
* by its own rules — no brief, a spent repair budget — carries `error` alone,
|
|
3749
|
+
* and is rendered as something to act on rather than something that broke.
|
|
3750
|
+
*/
|
|
3751
|
+
protected readonly failure: _angular_core.Signal<DraftFailure | undefined>;
|
|
3752
|
+
/**
|
|
3753
|
+
* Why the session stopped, on a `failed` session; `undefined` on any other.
|
|
3754
|
+
*
|
|
3755
|
+
* Falls back to a fixed line when `error` is empty, because a failed stage
|
|
3756
|
+
* with no reason on screen is the state this region exists to prevent.
|
|
3757
|
+
*/
|
|
3758
|
+
protected readonly stoppedReason: _angular_core.Signal<string | undefined>;
|
|
3759
|
+
/**
|
|
3760
|
+
* Where a crash happened, as one line — `TypeError during planning ·
|
|
3761
|
+
* Architect` — so the reader knows which stage and which model turn to look
|
|
3762
|
+
* at before opening the trace.
|
|
3763
|
+
*/
|
|
3764
|
+
protected readonly failureOrigin: _angular_core.Signal<string | undefined>;
|
|
3765
|
+
/** Text currently typed into the composer, not yet submitted. */
|
|
3766
|
+
protected readonly draftText: _angular_core.WritableSignal<string>;
|
|
3767
|
+
/** Tracks composer input as the user types. */
|
|
3768
|
+
protected onComposerInput(event: Event): void;
|
|
3769
|
+
/** Submits the composer text as a `describe` message and clears the composer. */
|
|
3770
|
+
protected submitMessage(): void;
|
|
3771
|
+
/** Emits `build`. No-op when {@link canBuild} is false. */
|
|
3772
|
+
protected emitBuild(): void;
|
|
3773
|
+
/** Emits the session's staged form for the canvas. No-op when nothing is staged. */
|
|
3774
|
+
protected acceptStaged(): void;
|
|
3775
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TFormDraftPanelComponent, never>;
|
|
3776
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TFormDraftPanelComponent, "t-form-draft-panel", never, { "session": { "alias": "session"; "required": true; "isSignal": true; }; "busy": { "alias": "busy"; "required": false; "isSignal": true; }; }, { "describe": "describe"; "build": "build"; "stage": "stage"; "discard": "discard"; }, never, never, true, never>;
|
|
3777
|
+
}
|
|
3778
|
+
|
|
2030
3779
|
declare class FormatDataPipe implements PipeTransform {
|
|
2031
3780
|
/**
|
|
2032
3781
|
* Formats an arbitrary input value for display according to `dataType`.
|
|
@@ -3104,5 +4853,5 @@ declare function testAgainstItem(test: ConfigurationValidTestInterface, item: un
|
|
|
3104
4853
|
*/
|
|
3105
4854
|
declare const getSignatureImage: (inputConfig: FormColumnInputs, value: EncryptedData | undefined, secret: string) => Promise<string | undefined>;
|
|
3106
4855
|
|
|
3107
|
-
export { DialogTemplateComponent, FORM_ACTIONS_TOKEN, FORM_CONFIG_TOKEN, FORM_INPUTS_TOKEN, FORM_ROUTE_SOURCE, FORM_SLIDES_TOKEN, FORM_SUGGESTION_REGISTRY, FormBuilderComponent, FormSuggestionRegistry, FormSuggestionRegistryService, FormTowerControllerService, FormatDataPipe, FormsComponent, HttpPipelineRepository, IMPORT_TOWER_INSTANCE_ID, INPUT_SECRET_TOKEN, MSCOA_TREE_PROVIDER, MULTIPLE_FORM_INPUT_TOKEN, MscoaFormInputComponent, NGX_T_FORMS_CONFIG_TOKEN, NgxTFormsComponent, NgxTFormsService, PIPELINE_REPOSITORY, PipelineRepository, PropertyAccessError, SignatureInputElementComponent, TDynamicDataEditComponent, TDynamicDataViewComponent, TFormImportController, TFormInputComponent, TSuggestionReviewComponent, UTILS_OBJECT_TOKEN, UserFormStepperComponent, ValidationExpressioCreatorComponent, assignDeepPropertyToObject, buildSuggestionSchema, createFileFromBase64, decrypt as decryptSecuredInputValue, formGenerator, generateSecretKey as generateInputSecretKey, getPipedValueFromDataType, getSampleValueForInput, getSectionElements, getSignatureImage, getUrl, getValueFromValueAccessor, initFormConfigToV2, provideNgxTForms, returnDeepProperty, returnMappedPathValue, safeReturnDeepProperty, sheetConsolodation, testAgainstItem, textIconsForUserHints, toSuggestionBatch, validateExpressionSyntax, validateObjectAgainstString, withFormSuggestions, withHttpPipeline, withInputSecret, withRouterFormId };
|
|
3108
|
-
export type { EditableFieldError, EditableFieldKind, EditableFieldSchema, EditableFieldValidation, FieldSuggestion, FormSuggestionChannel, FormSuggestionSnapshot, MscoaAccountSelection, MscoaCurrentSelection, MscoaFieldCapability, MscoaInnerInputDescriptor, MscoaSegmentDescriptor, MscoaSuggestionValue, MultipleRowSuggestionValue, StagedSuggestion, SuggestionBatch };
|
|
4856
|
+
export { AI_ENDPOINT_CATALOG, AI_FORM_BUILDER_CONFIG, AI_MSCOA_GROUNDING, DialogTemplateComponent, FORM_ACTIONS_TOKEN, FORM_CONFIG_TOKEN, FORM_DRAFT_ORCHESTRATOR, FORM_INPUTS_TOKEN, FORM_ROUTE_SOURCE, FORM_SLIDES_TOKEN, FORM_SUGGESTION_REGISTRY, FormBuilderComponent, FormDraftOrchestrator, FormSuggestionRegistry, FormSuggestionRegistryService, FormTowerControllerService, FormatDataPipe, FormsComponent, HashbrownFormDraftOrchestratorService, HttpPipelineRepository, IMPORT_TOWER_INSTANCE_ID, INPUT_SECRET_TOKEN, MSCOA_TREE_PROVIDER, MULTIPLE_FORM_INPUT_TOKEN, MscoaFormInputComponent, NGX_T_FORMS_CONFIG_TOKEN, NgxTFormsComponent, NgxTFormsService, PIPELINE_REPOSITORY, PipelineRepository, PropertyAccessError, SignatureInputElementComponent, TDynamicDataEditComponent, TDynamicDataViewComponent, TFormDraftPanelComponent, TFormImportController, TFormInputComponent, TSuggestionReviewComponent, UTILS_OBJECT_TOKEN, UserFormStepperComponent, ValidationExpressioCreatorComponent, assignDeepPropertyToObject, buildBlueprintSchema, buildBriefSchema, buildSuggestionSchema, createFileFromBase64, decrypt as decryptSecuredInputValue, formGenerator, generateSecretKey as generateInputSecretKey, getPipedValueFromDataType, getSampleValueForInput, getSectionElements, getSignatureImage, getUrl, getValueFromValueAccessor, initFormConfigToV2, provideNgxTForms, returnDeepProperty, returnMappedPathValue, safeReturnDeepProperty, sheetConsolodation, testAgainstItem, textIconsForUserHints, toSuggestionBatch, validateExpressionSyntax, validateObjectAgainstString, withAiEndpointCatalog, withAiFormBuilder, withAiMscoaGrounding, withFormSuggestions, withHttpPipeline, withInputSecret, withRouterFormId };
|
|
4857
|
+
export type { AiEndpointCatalogEntry, AiEndpointCatalogProvider, AiEndpointCatalogSource, AiEndpointSlot, AiFormBuilderBudgets, AiFormBuilderConfig, AiFormBuilderModels, AiFormBuilderRole, AiMscoaAccountingBasis, AiMscoaGrounding, AiMscoaSegmentDescriptor, BlueprintField, BlueprintSlide, DescribeOptions, DraftFailure, DraftFinding, DraftFindingKind, DraftFindingSeverity, DraftMessage, DraftMessageAuthor, DraftPartial, DraftRepairRoute, DraftRepairTurn, DraftRepairTurnKind, DraftRequestMiddleware, DraftSession, DraftStage, DraftTelemetry, EditableFieldError, EditableFieldKind, EditableFieldSchema, EditableFieldValidation, FieldSuggestion, FormBlueprint, FormBrief, FormBriefField, FormBriefRule, FormSuggestionChannel, FormSuggestionSnapshot, MscoaAccountSelection, MscoaCurrentSelection, MscoaFieldCapability, MscoaInnerInputDescriptor, MscoaSegmentDescriptor, MscoaSuggestionValue, MultipleRowSuggestionValue, StagedSuggestion, SuggestionBatch };
|