@autobe/agent 0.16.1 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/AutoBeAgent.js +9 -9
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +2 -2
- package/lib/context/AutoBeContext.d.ts +16 -4
- package/lib/context/AutoBeTokenUsage.d.ts +168 -11
- package/lib/context/AutoBeTokenUsage.js +152 -32
- package/lib/context/AutoBeTokenUsage.js.map +1 -1
- package/lib/context/AutoBeTokenUsageComponent.d.ts +116 -0
- package/lib/context/AutoBeTokenUsageComponent.js +120 -0
- package/lib/context/AutoBeTokenUsageComponent.js.map +1 -0
- package/lib/factory/createAutoBeApplication.js +1 -1
- package/lib/factory/createAutoBeApplication.js.map +1 -1
- package/lib/factory/createAutoBeContext.d.ts +19 -0
- package/lib/factory/createAutoBeContext.js +141 -0
- package/lib/factory/createAutoBeContext.js.map +1 -0
- package/lib/factory/getAutoBeGenerated.d.ts +1 -1
- package/lib/factory/getAutoBeGenerated.js +14 -11
- package/lib/factory/getAutoBeGenerated.js.map +1 -1
- package/lib/factory/getAutoBeRealizeGenerated.d.ts +7 -0
- package/lib/factory/getAutoBeRealizeGenerated.js +27 -0
- package/lib/factory/getAutoBeRealizeGenerated.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +1090 -927
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js +9 -36
- package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeReviewer.js +9 -9
- package/lib/orchestrate/analyze/orchestrateAnalyzeReviewer.js.map +1 -1
- package/lib/orchestrate/analyze/writeDocumentUntilReviewPassed.js +1 -1
- package/lib/orchestrate/analyze/writeDocumentUntilReviewPassed.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterface.js +6 -23
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
- package/lib/orchestrate/prisma/{transformPrismaComponentsHistories.d.ts → histories/transformPrismaComponentsHistories.d.ts} +1 -1
- package/lib/orchestrate/prisma/{transformPrismaComponentsHistories.js → histories/transformPrismaComponentsHistories.js} +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -0
- package/lib/orchestrate/prisma/histories/transformPrismaCorrectHistories.js.map +1 -0
- package/lib/orchestrate/prisma/{transformPrismaHistories.d.ts → histories/transformPrismaHistories.d.ts} +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaHistories.js.map +1 -0
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +48 -0
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -0
- package/lib/orchestrate/prisma/orchestratePrisma.d.ts +1 -1
- package/lib/orchestrate/prisma/orchestratePrisma.js +9 -29
- package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js +126 -19
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +10 -10
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +128 -150
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
- package/lib/orchestrate/prisma/structures/IAutoBePrismaComponentApplication.d.ts +120 -0
- package/lib/orchestrate/prisma/structures/IAutoBePrismaComponentApplication.js +3 -0
- package/lib/orchestrate/prisma/structures/IAutoBePrismaComponentApplication.js.map +1 -0
- package/lib/orchestrate/prisma/structures/IAutoBePrismaCorrectApplication.d.ts +142 -0
- package/lib/orchestrate/prisma/structures/IAutoBePrismaCorrectApplication.js +3 -0
- package/lib/orchestrate/prisma/structures/IAutoBePrismaCorrectApplication.js.map +1 -0
- package/lib/orchestrate/prisma/structures/IAutoBePrismaSchemaApplication.d.ts +209 -0
- package/lib/orchestrate/prisma/structures/IAutoBePrismaSchemaApplication.js +3 -0
- package/lib/orchestrate/prisma/structures/IAutoBePrismaSchemaApplication.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealize.js +13 -24
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCoder.js +23 -23
- package/lib/orchestrate/realize/orchestrateRealizeCoder.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTest.js +8 -26
- package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.js +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestWrite.js +1 -1
- package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/package.json +7 -7
- package/src/AutoBeAgent.ts +10 -9
- package/src/constants/AutoBeSystemPromptConstant.ts +2 -2
- package/src/context/AutoBeContext.ts +30 -3
- package/src/context/AutoBeTokenUsage.ts +252 -54
- package/src/context/AutoBeTokenUsageComponent.ts +180 -0
- package/src/factory/createAutoBeApplication.ts +1 -1
- package/src/factory/createAutoBeContext.ts +193 -0
- package/src/factory/getAutoBeGenerated.ts +14 -21
- package/src/factory/getAutoBeRealizeGenerated.ts +30 -0
- package/src/index.ts +1 -0
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +9 -38
- package/src/orchestrate/analyze/orchestrateAnalyzeReviewer.ts +1 -1
- package/src/orchestrate/analyze/writeDocumentUntilReviewPassed.ts +1 -1
- package/src/orchestrate/interface/orchestrateInterface.ts +4 -21
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +1 -1
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +1 -1
- package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +1 -1
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +1 -1
- package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +1 -1
- package/src/orchestrate/prisma/{transformPrismaComponentsHistories.ts → histories/transformPrismaComponentsHistories.ts} +2 -2
- package/src/orchestrate/prisma/{transformPrismaCorrectHistories.ts → histories/transformPrismaCorrectHistories.ts} +1 -1
- package/src/orchestrate/prisma/{transformPrismaHistories.ts → histories/transformPrismaHistories.ts} +2 -2
- package/src/orchestrate/prisma/{transformPrismaSchemaHistories.ts → histories/transformPrismaSchemaHistories.ts} +1 -1
- package/src/orchestrate/prisma/orchestratePrisma.ts +45 -68
- package/src/orchestrate/prisma/orchestratePrismaComponent.ts +13 -81
- package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +8 -148
- package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +15 -82
- package/src/orchestrate/prisma/structures/IAutoBePrismaComponentApplication.ts +124 -0
- package/src/orchestrate/prisma/structures/IAutoBePrismaCorrectApplication.ts +144 -0
- package/src/orchestrate/prisma/structures/IAutoBePrismaSchemaApplication.ts +214 -0
- package/src/orchestrate/realize/orchestrateRealize.ts +19 -32
- package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +1 -1
- package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +1 -1
- package/src/orchestrate/realize/orchestrateRealizeCoder.ts +1 -1
- package/src/orchestrate/test/orchestrateTest.ts +6 -26
- package/src/orchestrate/test/orchestrateTestCorrect.ts +1 -1
- package/src/orchestrate/test/orchestrateTestScenario.ts +1 -1
- package/src/orchestrate/test/orchestrateTestWrite.ts +1 -1
- package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js.map +0 -1
- package/lib/orchestrate/prisma/transformPrismaCorrectHistories.js.map +0 -1
- package/lib/orchestrate/prisma/transformPrismaHistories.js.map +0 -1
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js +0 -48
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js.map +0 -1
- /package/lib/orchestrate/prisma/{transformPrismaCorrectHistories.d.ts → histories/transformPrismaCorrectHistories.d.ts} +0 -0
- /package/lib/orchestrate/prisma/{transformPrismaCorrectHistories.js → histories/transformPrismaCorrectHistories.js} +0 -0
- /package/lib/orchestrate/prisma/{transformPrismaHistories.js → histories/transformPrismaHistories.js} +0 -0
- /package/lib/orchestrate/prisma/{transformPrismaSchemaHistories.d.ts → histories/transformPrismaSchemaHistories.d.ts} +0 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { AutoBePrisma } from "@autobe/interface";
|
|
2
|
+
|
|
3
|
+
export interface IAutoBePrismaComponentApplication {
|
|
4
|
+
/**
|
|
5
|
+
* Organizes database tables into domain-based components for Prisma schema
|
|
6
|
+
* generation.
|
|
7
|
+
*
|
|
8
|
+
* Takes business requirements and groups related tables into logical domains,
|
|
9
|
+
* with each component becoming a separate .prisma file.
|
|
10
|
+
*/
|
|
11
|
+
extractComponents(props: IAutoBePrismaComponentApplication.IProps): void;
|
|
12
|
+
}
|
|
13
|
+
export namespace IAutoBePrismaComponentApplication {
|
|
14
|
+
export interface IProps {
|
|
15
|
+
/**
|
|
16
|
+
* Initial thoughts on namespace classification criteria.
|
|
17
|
+
*
|
|
18
|
+
* Contains the AI agent's initial analysis and reasoning about how to
|
|
19
|
+
* organize tables into different business domains/namespaces.
|
|
20
|
+
*
|
|
21
|
+
* **Example:**
|
|
22
|
+
*
|
|
23
|
+
* "Based on the business requirements, I identify several key domains:
|
|
24
|
+
* - User-related entities should be grouped under 'Actors' namespace
|
|
25
|
+
* - Product and sales information under 'Sales' namespace
|
|
26
|
+
* - System configuration under 'Systematic' namespace"
|
|
27
|
+
*/
|
|
28
|
+
thinking: string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Review and refinement of the namespace classification.
|
|
32
|
+
*
|
|
33
|
+
* Contains the AI agent's review process, considering relationships between
|
|
34
|
+
* tables and potential improvements to the initial classification.
|
|
35
|
+
*
|
|
36
|
+
* **Example:**
|
|
37
|
+
*
|
|
38
|
+
* "Upon review, I noticed that 'shopping_channel_categories' has strong
|
|
39
|
+
* relationships with both channels and sales. However, since it primarily
|
|
40
|
+
* defines the channel structure, it should remain in 'Systematic' namespace."
|
|
41
|
+
*/
|
|
42
|
+
review: string;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Final decision on namespace classification.
|
|
46
|
+
*
|
|
47
|
+
* Contains the AI agent's final reasoning and rationale for the chosen
|
|
48
|
+
* namespace organization, explaining why this structure best serves the
|
|
49
|
+
* business requirements.
|
|
50
|
+
*
|
|
51
|
+
* **Example:**
|
|
52
|
+
*
|
|
53
|
+
* "Final decision: Organize tables into 3 main namespaces:
|
|
54
|
+
* 1. Systematic - for channel and system configuration
|
|
55
|
+
* 2. Actors - for all user types (customers, citizens, administrators)
|
|
56
|
+
* 3. Sales - for product sales and related transactional data
|
|
57
|
+
* This structure provides clear separation of concerns and follows DDD principles."
|
|
58
|
+
*/
|
|
59
|
+
decision: string;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Array of domain components that group related database tables.
|
|
63
|
+
*
|
|
64
|
+
* Each component represents a business domain and becomes one Prisma schema
|
|
65
|
+
* file. Common domains include: Actors (users), Sales (products), Orders,
|
|
66
|
+
* Carts, etc.
|
|
67
|
+
*
|
|
68
|
+
* **Example:**
|
|
69
|
+
*
|
|
70
|
+
* ```typescript
|
|
71
|
+
* {
|
|
72
|
+
* "components": [
|
|
73
|
+
* {
|
|
74
|
+
* "filename": "schema-02-systematic.prisma",
|
|
75
|
+
* "namespace": "Systematic",
|
|
76
|
+
* "thinking": "These tables all relate to system configuration and channel management. They form the foundation of the platform.",
|
|
77
|
+
* "review": "Considering the relationships, shopping_channel_categories connects channels and sales, but it fundamentally defines channel structure.",
|
|
78
|
+
* "rationale": "Grouping all system configuration tables together provides a clear foundation layer that other domains can reference.",
|
|
79
|
+
* "tables": [
|
|
80
|
+
* "shopping_channels",
|
|
81
|
+
* "shopping_sections",
|
|
82
|
+
* "shopping_channel_categories"
|
|
83
|
+
* ]
|
|
84
|
+
* },
|
|
85
|
+
* {
|
|
86
|
+
* "filename": "schema-03-actors.prisma",
|
|
87
|
+
* "namespace": "Actors",
|
|
88
|
+
* "thinking": "All user-related entities should be grouped together as they share authentication and identity patterns.",
|
|
89
|
+
* "review": "While customers interact with sales, the customer entity itself is about identity, not transactions.",
|
|
90
|
+
* "rationale": "This component groups all actor-related tables to maintain separation between identity management and business transactions.",
|
|
91
|
+
* "tables": [
|
|
92
|
+
* "shopping_customers",
|
|
93
|
+
* "shopping_citizens",
|
|
94
|
+
* "shopping_administrators"
|
|
95
|
+
* ]
|
|
96
|
+
* },
|
|
97
|
+
* {
|
|
98
|
+
* "filename": "schema-04-sales.prisma",
|
|
99
|
+
* "namespace": "Sales",
|
|
100
|
+
* "thinking": "Product catalog and sales-related tables belong together as they form the core commerce functionality.",
|
|
101
|
+
* "review": "Sales snapshots are integral to the sales domain for tracking product history and price changes.",
|
|
102
|
+
* "rationale": "Consolidating all sales-related tables enables coherent management of the entire product lifecycle.",
|
|
103
|
+
* "tables": [
|
|
104
|
+
* "shopping_sales",
|
|
105
|
+
* "shopping_sale_snapshots",
|
|
106
|
+
* "shopping_sale_units",
|
|
107
|
+
* "shopping_sale_unit_options"
|
|
108
|
+
* ]
|
|
109
|
+
* }
|
|
110
|
+
* ]
|
|
111
|
+
* }
|
|
112
|
+
* ```
|
|
113
|
+
*
|
|
114
|
+
* **Notes:**
|
|
115
|
+
*
|
|
116
|
+
* - Table names must follow snake_case convention with domain prefix (e.g.,
|
|
117
|
+
* `shopping_customers`)
|
|
118
|
+
* - Each component becomes one `.prisma` file containing related models
|
|
119
|
+
* - Filename numbering indicates dependency order for schema generation
|
|
120
|
+
* - Namespace is used for documentation organization and domain grouping
|
|
121
|
+
*/
|
|
122
|
+
components: AutoBePrisma.IComponent[];
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { AutoBePrisma } from "@autobe/interface";
|
|
2
|
+
|
|
3
|
+
export interface IAutoBePrismaCorrectApplication {
|
|
4
|
+
/**
|
|
5
|
+
* Fixes validation errors in specific AutoBePrisma models while preserving
|
|
6
|
+
* ALL existing business logic and model descriptions.
|
|
7
|
+
*
|
|
8
|
+
* ## Core Rules
|
|
9
|
+
*
|
|
10
|
+
* 1. Fix ONLY validation errors in provided models - never remove business
|
|
11
|
+
* descriptions
|
|
12
|
+
* 2. Apply minimal changes to error models only - preserve original design
|
|
13
|
+
* intent
|
|
14
|
+
* 3. Return ONLY corrected models - unchanged models remain in original schema
|
|
15
|
+
* 4. Maintain referential integrity with unchanged models
|
|
16
|
+
*
|
|
17
|
+
* ## Targeted Scope
|
|
18
|
+
*
|
|
19
|
+
* - Process ONLY models with validation errors from IError[] array
|
|
20
|
+
* - Exclude models without errors from processing and output
|
|
21
|
+
* - Minimize context usage by returning corrected models only
|
|
22
|
+
* - Preserve unchanged models in their original state
|
|
23
|
+
*
|
|
24
|
+
* ## Fix Strategy
|
|
25
|
+
*
|
|
26
|
+
* - Resolve validation errors within specific models only
|
|
27
|
+
* - Fix field duplications, invalid references, and type mismatches
|
|
28
|
+
* - Update cross-model references without modifying target models
|
|
29
|
+
* - Ensure naming conventions and index rules compliance in corrected models
|
|
30
|
+
*/
|
|
31
|
+
correctPrismaSchemaFiles(props: IAutoBePrismaCorrectApplication.IProps): void;
|
|
32
|
+
}
|
|
33
|
+
export namespace IAutoBePrismaCorrectApplication {
|
|
34
|
+
export interface IProps {
|
|
35
|
+
/**
|
|
36
|
+
* Detailed execution plan for fixing `AutoBePrisma` validation errors in
|
|
37
|
+
* specific models.
|
|
38
|
+
*
|
|
39
|
+
* 🎯 Purpose: Enable systematic reasoning and step-by-step error resolution
|
|
40
|
+
* approach for targeted model validation issues
|
|
41
|
+
*
|
|
42
|
+
* 📋 Required Planning Content:
|
|
43
|
+
*
|
|
44
|
+
* 1. **Error Scope Analysis**
|
|
45
|
+
*
|
|
46
|
+
* - List all validation errors from IAutoBePrismaValidation.IError[] array
|
|
47
|
+
* - Extract unique table names from errors to identify affected models
|
|
48
|
+
* - Categorize errors by type (field duplications, references, types,
|
|
49
|
+
* indexes)
|
|
50
|
+
* - Identify which models need correction vs. which remain unchanged
|
|
51
|
+
* 2. **Targeted Fix Strategy**
|
|
52
|
+
*
|
|
53
|
+
* - Focus ONLY on models mentioned in validation errors
|
|
54
|
+
* - Outline minimal changes needed for each affected model
|
|
55
|
+
* - Plan cross-model reference updates (if any) without modifying non-error
|
|
56
|
+
* models
|
|
57
|
+
* - Ensure unchanged models maintain valid references to corrected models
|
|
58
|
+
* 3. **Model-Specific Fix Plan**
|
|
59
|
+
*
|
|
60
|
+
* - Model-by-model modification plan for ONLY affected models
|
|
61
|
+
* - Exact field additions, renames, or type corrections required
|
|
62
|
+
* - Reference updates within corrected models only
|
|
63
|
+
* - Index corrections limited to affected models
|
|
64
|
+
* 4. **Minimal Scope Validation**
|
|
65
|
+
*
|
|
66
|
+
* - Confirm which models will be included in output (error models only)
|
|
67
|
+
* - List models that will remain unchanged in original schema
|
|
68
|
+
* - Identify cross-model dependencies without including unchanged models
|
|
69
|
+
* - Preserve all business logic within corrected models
|
|
70
|
+
* 5. **Targeted Impact Assessment**
|
|
71
|
+
*
|
|
72
|
+
* - Potential effects of fixes on unchanged models (reference validation)
|
|
73
|
+
* - Verification points for corrected models only
|
|
74
|
+
* - Ensure no new validation errors in targeted models
|
|
75
|
+
* - Confirm minimal output scope compliance
|
|
76
|
+
*
|
|
77
|
+
* 💡 Example Planning Structure:
|
|
78
|
+
*
|
|
79
|
+
* ## Error Scope
|
|
80
|
+
* - Target Models: shopping_customers, shopping_orders (2 models only)
|
|
81
|
+
* - Unchanged Models: All others remain in original schema
|
|
82
|
+
*
|
|
83
|
+
* ## Targeted Fixes
|
|
84
|
+
* - shopping_customers: Remove duplicate 'email' field
|
|
85
|
+
* - shopping_orders: Update targetModel reference to 'shopping_customers'
|
|
86
|
+
*
|
|
87
|
+
* ## Output Scope
|
|
88
|
+
* - Return: Only shopping_customers and shopping_orders models
|
|
89
|
+
* - Preserve: All other models unchanged in original schema
|
|
90
|
+
*
|
|
91
|
+
* ## Cross-Model Impact
|
|
92
|
+
* - Verify: shopping_orders still references shopping_customers correctly
|
|
93
|
+
* - No changes needed in other models referencing these
|
|
94
|
+
*/
|
|
95
|
+
planning: string;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* ONLY the specific models that contain validation errors and need
|
|
99
|
+
* correction.
|
|
100
|
+
*
|
|
101
|
+
* 📥 Input Structure:
|
|
102
|
+
*
|
|
103
|
+
* - Contains ONLY models mentioned in IAutoBePrismaValidation.IError[] array
|
|
104
|
+
* - Each model has specific validation errors that need targeted correction
|
|
105
|
+
* - Models not mentioned in errors are excluded from this input
|
|
106
|
+
* - Represents minimal scope for error correction
|
|
107
|
+
*
|
|
108
|
+
* 🔍 Expected Validation Issues (Model-Specific):
|
|
109
|
+
*
|
|
110
|
+
* - Duplicate field/relation names within these specific models
|
|
111
|
+
* - Invalid foreign key references from these models to other models
|
|
112
|
+
* - Single foreign key fields in index arrays within these models
|
|
113
|
+
* - Invalid naming conventions within these specific models
|
|
114
|
+
* - Type validation errors in fields of these models
|
|
115
|
+
*
|
|
116
|
+
* 📝 Model Content Analysis (Targeted Scope):
|
|
117
|
+
*
|
|
118
|
+
* - Complete field definitions for each error model only
|
|
119
|
+
* - Relationships from these models (may reference unchanged models)
|
|
120
|
+
* - Indexes within these models that need correction
|
|
121
|
+
* - Business descriptions specific to these models
|
|
122
|
+
* - Cross-model references that need validation (read-only for targets)
|
|
123
|
+
*
|
|
124
|
+
* ⚠️ Processing Notes (Focused Approach):
|
|
125
|
+
*
|
|
126
|
+
* - Input contains ONLY models with validation errors
|
|
127
|
+
* - May reference other models not included in this input
|
|
128
|
+
* - Cross-model references must be validated but target models won't be
|
|
129
|
+
* modified
|
|
130
|
+
* - Output should return corrected versions of ONLY these input models
|
|
131
|
+
* - All business logic and descriptions within these models must be preserved
|
|
132
|
+
* - Corrections must not break references from unchanged models
|
|
133
|
+
*
|
|
134
|
+
* 🎯 Correction Scope:
|
|
135
|
+
*
|
|
136
|
+
* - Fix validation errors within these specific models
|
|
137
|
+
* - Update internal model structure (fields, relations, indexes)
|
|
138
|
+
* - Correct references to external models (without modifying targets)
|
|
139
|
+
* - Maintain compatibility with unchanged models in the full schema
|
|
140
|
+
* - Return corrected versions of ONLY these models
|
|
141
|
+
*/
|
|
142
|
+
models: AutoBePrisma.IModel[];
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { AutoBePrisma } from "@autobe/interface";
|
|
2
|
+
|
|
3
|
+
export interface IAutoBePrismaSchemaApplication {
|
|
4
|
+
/**
|
|
5
|
+
* Generates comprehensive Prisma schema files based on detailed requirements
|
|
6
|
+
* analysis.
|
|
7
|
+
*
|
|
8
|
+
* Creates multiple organized schema files following enterprise patterns
|
|
9
|
+
* including proper domain separation, relationship modeling, snapshot
|
|
10
|
+
* patterns, inheritance, materialized views, and comprehensive documentation.
|
|
11
|
+
* The generated schemas implement best practices for scalability,
|
|
12
|
+
* maintainability, and data integrity.
|
|
13
|
+
*
|
|
14
|
+
* @param props Properties containing the file
|
|
15
|
+
*/
|
|
16
|
+
makePrismaSchemaFile(props: IAutoBePrismaSchemaApplication.IProps): void;
|
|
17
|
+
}
|
|
18
|
+
export namespace IAutoBePrismaSchemaApplication {
|
|
19
|
+
export interface IProps {
|
|
20
|
+
/**
|
|
21
|
+
* Step 1: Strategic database design analysis and planning.
|
|
22
|
+
*
|
|
23
|
+
* AI analyzes the target component and business requirements to formulate a
|
|
24
|
+
* comprehensive database design strategy. This planning phase is crucial
|
|
25
|
+
* for creating well-structured, normalized schemas that align with business
|
|
26
|
+
* objectives. The AI must define table structures, relationships, indexing
|
|
27
|
+
* strategies, and data integrity constraints before proceeding to schema
|
|
28
|
+
* implementation.
|
|
29
|
+
*
|
|
30
|
+
* **Key Considerations:**
|
|
31
|
+
*
|
|
32
|
+
* - **Assignment Validation**: Extract targetComponent.tables as the complete
|
|
33
|
+
* specification
|
|
34
|
+
* - **Table Count**: Must create exactly targetComponent.tables.length models
|
|
35
|
+
* - **Other Components**: Identify already-created tables for foreign key
|
|
36
|
+
* references only
|
|
37
|
+
* - **Normalization**: Strict adherence to 1NF, 2NF, 3NF principles
|
|
38
|
+
* - **Snapshot Architecture**: Design for historical data preservation and
|
|
39
|
+
* audit trails
|
|
40
|
+
* - **Junction Tables**: Plan M:N relationships with proper naming
|
|
41
|
+
* ({table1}_{table2})
|
|
42
|
+
* - **Materialized Views**: Identify needs for mv_ prefixed denormalized
|
|
43
|
+
* tables
|
|
44
|
+
*
|
|
45
|
+
* Workflow: Component analysis → Strategic planning → Design rationale
|
|
46
|
+
*/
|
|
47
|
+
thinking: string;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Step 2: Initial Prisma schema code implementation.
|
|
51
|
+
*
|
|
52
|
+
* AI generates the first working version of the Prisma schema based on the
|
|
53
|
+
* strategic plan. This draft must be syntactically correct Prisma Schema
|
|
54
|
+
* Language (PSL) code that implements all planned tables, relationships,
|
|
55
|
+
* and constraints. The schema should follow Prisma conventions while
|
|
56
|
+
* incorporating enterprise patterns like snapshot tables and materialized
|
|
57
|
+
* views.
|
|
58
|
+
*
|
|
59
|
+
* **Implementation Requirements:**
|
|
60
|
+
*
|
|
61
|
+
* - **Exact Table Names**: Use EXACT names from targetComponent.tables (NO
|
|
62
|
+
* CHANGES)
|
|
63
|
+
* - **Valid PSL Syntax**: Proper model blocks, field definitions, and
|
|
64
|
+
* directives
|
|
65
|
+
* - **Primary Keys**: Always UUID type with `@id` directive
|
|
66
|
+
* - **Foreign Keys**: UUID type following {target_model}_id naming pattern
|
|
67
|
+
* - **Data Types**: uuid, string, int, double, datetime, boolean, uri (no
|
|
68
|
+
* pre-calculated fields)
|
|
69
|
+
* - **Relationships**: Proper `@relation` directives for 1:1, 1:N, M:N
|
|
70
|
+
* patterns
|
|
71
|
+
* - **Descriptions**: Follow format with requirements mapping and business
|
|
72
|
+
* purpose
|
|
73
|
+
* - **NO Prohibited Fields**: No totals, cached values, aggregates in regular
|
|
74
|
+
* tables
|
|
75
|
+
*
|
|
76
|
+
* Workflow: Strategic plan → PSL implementation → Functional schema code
|
|
77
|
+
*/
|
|
78
|
+
draft: string;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Step 3: Schema code review and quality assessment.
|
|
82
|
+
*
|
|
83
|
+
* AI performs a thorough review of the draft schema implementation,
|
|
84
|
+
* examining multiple quality dimensions to ensure production readiness.
|
|
85
|
+
* This review process identifies issues, suggests improvements, and
|
|
86
|
+
* validates compliance with best practices.
|
|
87
|
+
*
|
|
88
|
+
* **Review Dimensions:**
|
|
89
|
+
*
|
|
90
|
+
* **Syntax & Compilation:**
|
|
91
|
+
*
|
|
92
|
+
* - Prisma schema syntax errors and invalid directives
|
|
93
|
+
* - Model naming matches targetComponent.tables EXACTLY
|
|
94
|
+
* - Field type appropriateness (uuid for keys, no calculated fields)
|
|
95
|
+
* - Relationship definition correctness (`@relation` syntax)
|
|
96
|
+
*
|
|
97
|
+
* **Database Design Quality:**
|
|
98
|
+
*
|
|
99
|
+
* - **Normalization Compliance**:
|
|
100
|
+
*
|
|
101
|
+
* - 1NF: Atomic values, no repeating groups
|
|
102
|
+
* - 2NF: No partial dependencies on composite keys
|
|
103
|
+
* - 3NF: No transitive dependencies
|
|
104
|
+
* - **Prohibited Fields Check**: No pre-calculated totals, cached values, or
|
|
105
|
+
* aggregates in regular tables
|
|
106
|
+
* - **Snapshot Pattern**: Proper implementation for audit trails
|
|
107
|
+
* - **Junction Tables**: Correct naming ({table1}_{table2}) and structure
|
|
108
|
+
*
|
|
109
|
+
* **Index Strategy Validation:**
|
|
110
|
+
*
|
|
111
|
+
* - NO single foreign key indexes (Prisma auto-creates these)
|
|
112
|
+
* - Composite indexes for query patterns
|
|
113
|
+
* - Unique indexes for business constraints
|
|
114
|
+
* - GIN indexes for full-text search fields
|
|
115
|
+
*
|
|
116
|
+
* **Description Quality:**
|
|
117
|
+
*
|
|
118
|
+
* - Models include: requirement mapping, business purpose, relationships,
|
|
119
|
+
* behaviors
|
|
120
|
+
* - Fields include: requirement aspect, business meaning, normalization
|
|
121
|
+
* rationale
|
|
122
|
+
*
|
|
123
|
+
* Workflow: Draft schema → Systematic analysis → Specific improvements
|
|
124
|
+
*/
|
|
125
|
+
review: string;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Step 4: Final production-ready Prisma schema code.
|
|
129
|
+
*
|
|
130
|
+
* AI produces the final, polished version of the Prisma schema
|
|
131
|
+
* incorporating all review feedback. This code represents the completed
|
|
132
|
+
* schema implementation, ready for database migration and production
|
|
133
|
+
* deployment. All identified issues must be resolved, and the schema must
|
|
134
|
+
* meet enterprise-grade quality standards.
|
|
135
|
+
*
|
|
136
|
+
* **Final Schema Characteristics:**
|
|
137
|
+
*
|
|
138
|
+
* - **Complete Coverage**: All targetComponent.tables implemented with exact
|
|
139
|
+
* names
|
|
140
|
+
* - **Zero Errors**: Valid PSL syntax, no compilation warnings
|
|
141
|
+
* - **Proper Relationships**: All foreign keys reference existing tables
|
|
142
|
+
* correctly
|
|
143
|
+
* - **Optimized Indexes**: Strategic indexes without redundant foreign key
|
|
144
|
+
* indexes
|
|
145
|
+
* - **Full Normalization**: Strict 3NF compliance, denormalization only in
|
|
146
|
+
* mv_ tables
|
|
147
|
+
* - **Enterprise Documentation**: Complete descriptions with business context
|
|
148
|
+
* - **Audit Support**: Proper snapshot patterns and temporal fields
|
|
149
|
+
* (created_at, updated_at, deleted_at)
|
|
150
|
+
* - **Type Safety**: Consistent use of UUID for all keys, appropriate field
|
|
151
|
+
* types
|
|
152
|
+
*
|
|
153
|
+
* Workflow: Review feedback → Schema refinement → Production-ready PSL code
|
|
154
|
+
*/
|
|
155
|
+
final: string;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Step 5: Structured AST representation of the Prisma schema models.
|
|
159
|
+
*
|
|
160
|
+
* AI transforms the final Prisma schema code into a structured Abstract
|
|
161
|
+
* Syntax Tree (AST) representation using the AutoBePrisma.IModel interface.
|
|
162
|
+
* This involves critical reinterpretation and reclassification of the final
|
|
163
|
+
* code to conform to AST constraints.
|
|
164
|
+
*
|
|
165
|
+
* **CRITICAL: Reinterpretation & Post-Processing Required**
|
|
166
|
+
*
|
|
167
|
+
* The AI-generated final code may not directly map to valid AST structures
|
|
168
|
+
* due to:
|
|
169
|
+
*
|
|
170
|
+
* - Complex Prisma directives that need decomposition
|
|
171
|
+
* - Field attributes that require reclassification
|
|
172
|
+
* - Implicit relationships that need explicit AST representation
|
|
173
|
+
* - Schema-level constructs that must be distributed to models
|
|
174
|
+
*
|
|
175
|
+
* **Required Post-Processing Steps:**
|
|
176
|
+
*
|
|
177
|
+
* 1. **Field Reclassification**: Separate fields into primary, foreign, and
|
|
178
|
+
* plain categories
|
|
179
|
+
* 2. **Relationship Extraction**: Convert `@relation` directives to IRelation
|
|
180
|
+
* structures
|
|
181
|
+
* 3. **Index Decomposition**: Parse `@@index`, `@@unique` into appropriate
|
|
182
|
+
* index arrays
|
|
183
|
+
* 4. **Type Normalization**: Map Prisma types to AST type enum values
|
|
184
|
+
* 5. **Constraint Resolution**: Convert schema constraints to AST properties
|
|
185
|
+
*
|
|
186
|
+
* **AST Structure Requirements:**
|
|
187
|
+
*
|
|
188
|
+
* - **Model Array**: Each table from targetComponent.tables as IModel
|
|
189
|
+
* - **Primary Field**: Always UUID type with name "id"
|
|
190
|
+
* - **Foreign Fields**: Proper IRelation configurations for all relationships
|
|
191
|
+
* - **Plain Fields**: Business fields with correct types (no calculated
|
|
192
|
+
* fields)
|
|
193
|
+
* - **Indexes**:
|
|
194
|
+
*
|
|
195
|
+
* - UniqueIndexes: Business constraints and composite unique keys
|
|
196
|
+
* - PlainIndexes: Query optimization (no single foreign key indexes)
|
|
197
|
+
* - GinIndexes: Full-text search on string fields
|
|
198
|
+
* - **Material Flag**: true only for mv_ prefixed tables
|
|
199
|
+
*
|
|
200
|
+
* **Relationship Patterns in AST:**
|
|
201
|
+
*
|
|
202
|
+
* - 1:1: Foreign field with unique: true
|
|
203
|
+
* - 1:N: Foreign field with unique: false
|
|
204
|
+
* - M:N: Separate junction table model with composite indexes
|
|
205
|
+
*
|
|
206
|
+
* Workflow: Final PSL code → Reinterpretation → AST transformation →
|
|
207
|
+
* Structured models
|
|
208
|
+
*
|
|
209
|
+
* This structured representation serves as the ultimate deliverable for
|
|
210
|
+
* programmatic schema generation and manipulation.
|
|
211
|
+
*/
|
|
212
|
+
models: AutoBePrisma.IModel[];
|
|
213
|
+
}
|
|
214
|
+
}
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
IAutoBeCompiler,
|
|
8
8
|
} from "@autobe/interface";
|
|
9
9
|
import { ILlmSchema } from "@samchon/openapi";
|
|
10
|
-
import { v4 } from "uuid";
|
|
11
10
|
|
|
12
11
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
13
12
|
import { IAutoBeApplicationProps } from "../../context/IAutoBeApplicationProps";
|
|
14
13
|
import { getAutoBeGenerated } from "../../factory/getAutoBeGenerated";
|
|
14
|
+
import { getAutoBeRealizeGenerated } from "../../factory/getAutoBeRealizeGenerated";
|
|
15
15
|
import { orchestrateRealizeAuthorization } from "./orchestrateRealizeAuthorization";
|
|
16
16
|
import { writeCodeUntilCompilePassed } from "./writeCodeUntilCompilePassed";
|
|
17
17
|
|
|
@@ -26,7 +26,6 @@ export const orchestrateRealize =
|
|
|
26
26
|
throw new Error("Can't do realize agent because operations are nothing.");
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
const start: Date = new Date();
|
|
30
29
|
ctx.dispatch({
|
|
31
30
|
type: "realizeStart",
|
|
32
31
|
created_at: new Date().toISOString(),
|
|
@@ -54,41 +53,29 @@ export const orchestrateRealize =
|
|
|
54
53
|
authorizations,
|
|
55
54
|
});
|
|
56
55
|
|
|
57
|
-
const history: AutoBeRealizeHistory = {
|
|
58
|
-
type: "realize",
|
|
59
|
-
compiled: result.compiled,
|
|
60
|
-
authorizations,
|
|
61
|
-
functions,
|
|
62
|
-
controllers,
|
|
63
|
-
completed_at: new Date().toISOString(),
|
|
64
|
-
created_at: start.toISOString(),
|
|
65
|
-
id: v4(),
|
|
66
|
-
reason: props.reason,
|
|
67
|
-
step: ctx.state().analyze?.step ?? 0,
|
|
68
|
-
};
|
|
69
|
-
|
|
70
56
|
// report
|
|
71
|
-
ctx.dispatch({
|
|
57
|
+
return ctx.dispatch({
|
|
72
58
|
type: "realizeComplete",
|
|
73
59
|
created_at: new Date().toISOString(),
|
|
74
|
-
functions
|
|
75
|
-
authorizations
|
|
76
|
-
controllers
|
|
60
|
+
functions,
|
|
61
|
+
authorizations,
|
|
62
|
+
controllers,
|
|
77
63
|
compiled: await compiler.typescript.compile({
|
|
78
|
-
files:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
64
|
+
files: {
|
|
65
|
+
...(await getAutoBeGenerated(
|
|
66
|
+
compiler,
|
|
67
|
+
ctx.state(),
|
|
68
|
+
ctx.histories(),
|
|
69
|
+
ctx.usage(),
|
|
70
|
+
)),
|
|
71
|
+
...(await getAutoBeRealizeGenerated({
|
|
72
|
+
document: ctx.state().interface!.document,
|
|
73
|
+
authorizations,
|
|
74
|
+
functions,
|
|
75
|
+
compiler,
|
|
76
|
+
})),
|
|
77
|
+
},
|
|
87
78
|
}),
|
|
88
79
|
step: ctx.state().analyze?.step ?? 0,
|
|
89
80
|
});
|
|
90
|
-
ctx.state().realize = history;
|
|
91
|
-
ctx.histories().push(history);
|
|
92
|
-
|
|
93
|
-
return history;
|
|
94
81
|
};
|
|
@@ -95,7 +95,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
95
95
|
await agentica
|
|
96
96
|
.conversate("Create Authorization Provider and Decorator.")
|
|
97
97
|
.finally(() => {
|
|
98
|
-
const tokenUsage = agentica.getTokenUsage();
|
|
98
|
+
const tokenUsage = agentica.getTokenUsage().aggregate;
|
|
99
99
|
ctx.usage().record(tokenUsage, ["realize"]);
|
|
100
100
|
});
|
|
101
101
|
if (pointer.value === null) throw new Error("Failed to create decorator.");
|
|
@@ -105,7 +105,7 @@ export async function orchestrateRealizeAuthorizationCorrect<
|
|
|
105
105
|
await agentica
|
|
106
106
|
.conversate("Please correct the decorator and the provider.")
|
|
107
107
|
.finally(() => {
|
|
108
|
-
const tokenUsage = agentica.getTokenUsage();
|
|
108
|
+
const tokenUsage = agentica.getTokenUsage().aggregate;
|
|
109
109
|
ctx.usage().record(tokenUsage, ["realize"]);
|
|
110
110
|
});
|
|
111
111
|
|
|
@@ -114,7 +114,7 @@ export const orchestrateRealizeCoder = async <Model extends ILlmSchema.Model>(
|
|
|
114
114
|
].join("\n"),
|
|
115
115
|
),
|
|
116
116
|
).finally(() => {
|
|
117
|
-
const tokenUsage = agent.getTokenUsage();
|
|
117
|
+
const tokenUsage = agent.getTokenUsage().aggregate;
|
|
118
118
|
ctx.usage().record(tokenUsage, ["realize"]);
|
|
119
119
|
});
|
|
120
120
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AutoBeAssistantMessageHistory,
|
|
3
3
|
AutoBeOpenApi,
|
|
4
|
-
AutoBeTestFile,
|
|
5
4
|
AutoBeTestHistory,
|
|
6
5
|
AutoBeTestScenarioEvent,
|
|
7
6
|
AutoBeTestValidateEvent,
|
|
@@ -33,8 +32,8 @@ export const orchestrateTest =
|
|
|
33
32
|
|
|
34
33
|
const operations: AutoBeOpenApi.IOperation[] =
|
|
35
34
|
ctx.state().interface?.document.operations ?? [];
|
|
36
|
-
if (operations.length === 0)
|
|
37
|
-
|
|
35
|
+
if (operations.length === 0)
|
|
36
|
+
return ctx.assistantMessage({
|
|
38
37
|
id: v4(),
|
|
39
38
|
type: "assistantMessage",
|
|
40
39
|
created_at: start.toISOString(),
|
|
@@ -42,11 +41,7 @@ export const orchestrateTest =
|
|
|
42
41
|
text:
|
|
43
42
|
"Unable to write test code because there are no Operations, " +
|
|
44
43
|
"please check if the Interface agent is called.",
|
|
45
|
-
};
|
|
46
|
-
ctx.histories().push(history);
|
|
47
|
-
ctx.dispatch(history);
|
|
48
|
-
return history;
|
|
49
|
-
}
|
|
44
|
+
});
|
|
50
45
|
|
|
51
46
|
// PLAN
|
|
52
47
|
const scenarioEvent: AutoBeTestScenarioEvent =
|
|
@@ -69,7 +64,6 @@ export const orchestrateTest =
|
|
|
69
64
|
|
|
70
65
|
// DO COMPILE
|
|
71
66
|
const compiler: IAutoBeCompiler = await ctx.compiler();
|
|
72
|
-
const result: AutoBeTestFile[] = success.map((c) => c.file);
|
|
73
67
|
const compiled: IAutoBeTypeScriptCompileResult =
|
|
74
68
|
await compiler.typescript.compile({
|
|
75
69
|
files: Object.fromEntries([
|
|
@@ -78,28 +72,14 @@ export const orchestrateTest =
|
|
|
78
72
|
dbms: "sqlite",
|
|
79
73
|
}),
|
|
80
74
|
).filter(([key]) => key.endsWith(".ts")),
|
|
81
|
-
...
|
|
75
|
+
...success.map((s) => [s.file.location, s.file.content]),
|
|
82
76
|
]),
|
|
83
77
|
});
|
|
84
|
-
|
|
85
|
-
const history: AutoBeTestHistory = {
|
|
86
|
-
type: "test",
|
|
87
|
-
id: v4(),
|
|
88
|
-
completed_at: new Date().toISOString(),
|
|
89
|
-
created_at: start.toISOString(),
|
|
90
|
-
files: result,
|
|
91
|
-
compiled,
|
|
92
|
-
reason: "Step to the test generation referencing the interface",
|
|
93
|
-
step: ctx.state().interface?.step ?? 0,
|
|
94
|
-
};
|
|
95
|
-
ctx.dispatch({
|
|
78
|
+
return ctx.dispatch({
|
|
96
79
|
type: "testComplete",
|
|
97
80
|
created_at: start.toISOString(),
|
|
98
|
-
files:
|
|
81
|
+
files: success.map((s) => s.file),
|
|
99
82
|
compiled,
|
|
100
83
|
step: ctx.state().interface?.step ?? 0,
|
|
101
84
|
});
|
|
102
|
-
ctx.state().test = history;
|
|
103
|
-
ctx.histories().push(history);
|
|
104
|
-
return history;
|
|
105
85
|
};
|
|
@@ -131,7 +131,7 @@ const correct = async <Model extends ILlmSchema.Model>(
|
|
|
131
131
|
"Fix the `AutoBeTest.IFunction` data to resolve the compilation error.",
|
|
132
132
|
)
|
|
133
133
|
.finally(() => {
|
|
134
|
-
const tokenUsage = agentica.getTokenUsage();
|
|
134
|
+
const tokenUsage = agentica.getTokenUsage().aggregate;
|
|
135
135
|
ctx.usage().record(tokenUsage, ["test"]);
|
|
136
136
|
});
|
|
137
137
|
if (pointer.value === null) throw new Error("Failed to modify test code.");
|
|
@@ -146,7 +146,7 @@ const execute = async <Model extends ILlmSchema.Model>(
|
|
|
146
146
|
enforceToolCall(agentica);
|
|
147
147
|
|
|
148
148
|
await agentica.conversate(`create test scenarios.`).finally(() => {
|
|
149
|
-
const tokenUsage = agentica.getTokenUsage();
|
|
149
|
+
const tokenUsage = agentica.getTokenUsage().aggregate;
|
|
150
150
|
ctx.usage().record(tokenUsage, ["test"]);
|
|
151
151
|
});
|
|
152
152
|
if (pointer.value.length === 0) {
|