@@ -11,18 +11,8 @@ import type { IAgentRuntime, Plugin, ServiceClass } from "@elizaos/core";
1111import { formRestoreAction } from "./actions/restore" ;
1212import { formEvaluator } from "./evaluators/extractor" ;
1313
14- // ============================================================================
15- // TYPE EXPORTS
16- // ============================================================================
17-
18- // Types - all interfaces and type definitions
1914export * from "./types" ;
2015
21- // ============================================================================
22- // BUILT-IN TYPES EXPORTS
23- // Pre-registered control types (text, number, email, etc.)
24- // ============================================================================
25-
2616export {
2717 BUILTIN_TYPE_MAP ,
2818 BUILTIN_TYPES ,
@@ -31,11 +21,6 @@ export {
3121 registerBuiltinTypes ,
3222} from "./builtins" ;
3323
34- // ============================================================================
35- // VALIDATION EXPORTS
36- // Field validation, type coercion, and custom type registration
37- // ============================================================================
38-
3924export {
4025 clearTypeHandlers ,
4126 formatValue ,
@@ -46,23 +31,6 @@ export {
4631 validateField ,
4732} from "./validation" ;
4833
49- // ============================================================================
50- // INTENT DETECTION EXPORTS
51- // Two-tier intent detection (fast path + LLM fallback)
52- // ============================================================================
53-
54- export {
55- hasDataToExtract ,
56- isLifecycleIntent ,
57- isUXIntent ,
58- quickIntentDetect ,
59- } from "./intent" ;
60-
61- // ============================================================================
62- // STORAGE EXPORTS
63- // Component-based persistence for sessions, submissions, autofill
64- // ============================================================================
65-
6634export {
6735 deleteSession ,
6836 getActiveSession ,
@@ -75,22 +43,15 @@ export {
7543 saveSubmission ,
7644} from "./storage" ;
7745
78- // ============================================================================
79- // EXTRACTION EXPORTS
80- // LLM-based field extraction from natural language
81- // ============================================================================
82-
8346export {
47+ buildFormExtractorPromptSection ,
48+ buildFormExtractorSchema ,
49+ coerceExtractionsAgainstControls ,
8450 detectCorrection ,
8551 extractSingleField ,
86- llmIntentAndExtract ,
52+ parseFormExtractorOutput ,
8753} from "./extraction" ;
8854
89- // ============================================================================
90- // TTL & EFFORT EXPORTS
91- // Smart retention based on user effort
92- // ============================================================================
93-
9455export {
9556 calculateTTL ,
9657 formatEffort ,
@@ -101,45 +62,16 @@ export {
10162 shouldNudge ,
10263} from "./ttl" ;
10364
104- // ============================================================================
105- // DEFAULTS EXPORTS
106- // Sensible default value application
107- // ============================================================================
108-
10965export { applyControlDefaults , applyFormDefaults , prettify } from "./defaults" ;
11066
111- // ============================================================================
112- // BUILDER API EXPORTS
113- // Fluent API for defining forms and controls
114- // ============================================================================
115-
11667export { C , ControlBuilder , Form , FormBuilder } from "./builder" ;
11768
118- // ============================================================================
119- // SERVICE EXPORT
120- // Central form management service
121- // ============================================================================
122-
12369export { FormService } from "./service" ;
12470
125- // ============================================================================
126- // COMPONENT EXPORTS
127- // Provider, Action, Tasks
128- // ============================================================================
129-
130- // Action - fast-path restore for stashed forms
13171export { formRestoreAction } from "./actions/restore" ;
132-
133- // Post-message hook - extracts fields and handles intents
134- // (Action with mode: ActionMode.ALWAYS_AFTER)
13572export { formEvaluator } from "./evaluators/extractor" ;
136- // Provider - injects form context into agent state
13773export { formContextProvider } from "./providers/context" ;
13874
139- // ============================================================================
140- // PLUGIN DEFINITION
141- // ============================================================================
142-
14375/**
14476 * Form Plugin
14577 *
@@ -150,11 +82,12 @@ export const formPlugin = {
15082 description : "Agent-native conversational forms for data collection" ,
15183 descriptionCompressed : "Conversational forms for structured data collection." ,
15284
153- // Self-declared auto-enable: activate when features.form is enabled.
15485 autoEnable : {
155- shouldEnable : ( _env : Record < string , string | undefined > , config : Record < string , unknown > ) => {
156- const f = ( config ?. features as Record < string , unknown > | undefined )
157- ?. form ;
86+ shouldEnable : (
87+ _env : Record < string , string | undefined > ,
88+ config : Record < string , unknown > ,
89+ ) => {
90+ const f = ( config ?. features as Record < string , unknown > | undefined ) ?. form ;
15891 return (
15992 f === true ||
16093 ( typeof f === "object" &&
@@ -164,7 +97,6 @@ export const formPlugin = {
16497 } ,
16598 } ,
16699
167- // Service for form management
168100 services : [
169101 {
170102 serviceType : "FORM" ,
@@ -175,7 +107,6 @@ export const formPlugin = {
175107 } as ServiceClass ,
176108 ] ,
177109
178- // Provider for form context
179110 providers : [
180111 {
181112 name : "FORM_CONTEXT" ,
@@ -188,9 +119,8 @@ export const formPlugin = {
188119 } ,
189120 ] ,
190121
191- // Action for restoring stashed forms before normal reply generation,
192- // plus the form-extraction post-message hook (mode: ALWAYS_AFTER).
193- actions : [ formRestoreAction , formEvaluator ] ,
122+ actions : [ formRestoreAction ] ,
123+ evaluators : [ formEvaluator ] ,
194124} as Plugin & { descriptionCompressed ?: string } ;
195125
196126export default formPlugin ;
0 commit comments