@autobe/agent 0.25.0 → 0.25.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 +11 -1
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/AutoBeMockAgent.js +1 -0
- package/lib/AutoBeMockAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +13 -13
- package/lib/factory/createAutoBeContext.js +1 -0
- package/lib/factory/createAutoBeContext.js.map +1 -1
- package/lib/index.mjs +2250 -806
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js +1 -1
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js.map +1 -1
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js +36 -23
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js.map +1 -1
- package/lib/orchestrate/common/structures/IAutoBeCommonCorrectCastingApplication.d.ts +22 -42
- package/lib/orchestrate/interface/histories/transformInterfaceCommonPrerequisiteHistories.d.ts +3 -0
- package/lib/orchestrate/interface/histories/{transformInterfacePrerequisiteHistories.js → transformInterfaceCommonPrerequisiteHistories.js} +4 -4
- package/lib/orchestrate/interface/histories/transformInterfaceCommonPrerequisiteHistories.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +3 -3
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.d.ts +3 -0
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.js +102 -0
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterface.js +25 -9
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js +260 -29
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +56 -64
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +3 -3
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +2 -2
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +4 -5
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js +260 -29
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.d.ts +5 -0
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js +713 -0
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +47 -35
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.js +41 -7
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +1 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.d.ts +0 -38
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.d.ts +6 -10
- package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.d.ts +52 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.d.ts +0 -33
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.d.ts +6 -2
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js +105 -5
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -1
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js +20 -1
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js.map +1 -1
- package/lib/orchestrate/interface/utils/OperationValidator.d.ts +3 -4
- package/lib/orchestrate/interface/utils/OperationValidator.js +1 -1
- package/lib/orchestrate/interface/utils/OperationValidator.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js +9 -10
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js +14 -22
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +6 -6
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js +8 -2
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
- package/lib/orchestrate/realize/internal/compileRealizeFiles.js +1 -2
- package/lib/orchestrate/realize/internal/compileRealizeFiles.js.map +1 -1
- package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.d.ts +2 -1
- package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js +103 -40
- package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealize.js +81 -45
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +117 -87
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeWrite.d.ts +2 -1
- package/lib/orchestrate/realize/orchestrateRealizeWrite.js +117 -54
- package/lib/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.d.ts +52 -26
- package/lib/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +44 -34
- package/lib/orchestrate/realize/utils/InternalFileSystem.js +1 -1
- package/lib/orchestrate/realize/utils/InternalFileSystem.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.d.ts +8 -3
- package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js +44 -17
- package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.d.ts +4 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.js +24 -9
- package/lib/orchestrate/realize/utils/getRealizeWriteImportStatements.js.map +1 -1
- package/lib/orchestrate/realize/utils/printErrorHints.d.ts +8 -0
- package/lib/orchestrate/realize/utils/printErrorHints.js +48 -0
- package/lib/orchestrate/realize/utils/printErrorHints.js.map +1 -0
- package/lib/orchestrate/realize/utils/replaceImportStatements.d.ts +1 -0
- package/lib/orchestrate/realize/utils/replaceImportStatements.js +93 -55
- package/lib/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.js +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js +10 -79
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js +15 -65
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestWriteHistories.js +1 -1
- package/lib/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.js +32 -17
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js +31 -13
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.d.ts +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js +5 -5
- package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js +1 -1
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestWrite.js +37 -21
- package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +9 -5
- package/lib/orchestrate/test/structures/IAutoBeTestCorrectInvalidRequestApplication.d.ts +8 -2
- package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +11 -7
- package/lib/orchestrate/test/utils/getPrerequisites.d.ts +5 -0
- package/lib/orchestrate/test/utils/getPrerequisites.js +36 -0
- package/lib/orchestrate/test/utils/getPrerequisites.js.map +1 -0
- package/lib/orchestrate/test/utils/getReferenceIds.js +1 -1
- package/lib/orchestrate/test/utils/getReferenceIds.js.map +1 -1
- package/package.json +5 -5
- package/src/AutoBeAgent.ts +17 -1
- package/src/AutoBeMockAgent.ts +1 -0
- package/src/constants/AutoBeSystemPromptConstant.ts +13 -13
- package/src/factory/createAutoBeContext.ts +1 -0
- package/src/orchestrate/common/orchestrateCommonCorrectCasting.ts +2 -2
- package/src/orchestrate/common/structures/IAutoBeCommonCorrectCastingApplication.ts +25 -45
- package/src/orchestrate/interface/histories/{transformInterfacePrerequisiteHistories.ts → transformInterfaceCommonPrerequisiteHistories.ts} +1 -1
- package/src/orchestrate/interface/histories/transformInterfaceGroupHistories.ts +4 -2
- package/src/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.ts +118 -0
- package/src/orchestrate/interface/orchestrateInterface.ts +43 -17
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +12 -33
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +5 -5
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +7 -6
- package/src/orchestrate/interface/orchestrateInterfacePrerequisites.ts +274 -0
- package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +1 -1
- package/src/orchestrate/interface/orchestrateInterfaceSchemasReview.ts +1 -1
- package/src/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.ts +0 -39
- package/src/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.ts +6 -10
- package/src/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.ts +58 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.ts +0 -34
- package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +92 -4
- package/src/orchestrate/interface/utils/JsonSchemaValidator.ts +19 -1
- package/src/orchestrate/interface/utils/OperationValidator.ts +9 -7
- package/src/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.ts +9 -10
- package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +13 -24
- package/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts +6 -6
- package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +6 -4
- package/src/orchestrate/realize/internal/compileRealizeFiles.ts +1 -5
- package/src/orchestrate/realize/orchestRateRealizeCorrectCasting.ts +84 -17
- package/src/orchestrate/realize/orchestrateRealize.ts +125 -74
- package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +33 -6
- package/src/orchestrate/realize/orchestrateRealizeWrite.ts +14 -4
- package/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.ts +54 -29
- package/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.ts +46 -35
- package/src/orchestrate/realize/utils/InternalFileSystem.ts +1 -1
- package/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.ts +54 -22
- package/src/orchestrate/realize/utils/getRealizeWriteImportStatements.ts +28 -16
- package/src/orchestrate/realize/utils/printErrorHints.ts +55 -0
- package/src/orchestrate/realize/utils/replaceImportStatements.ts +99 -102
- package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +18 -91
- package/src/orchestrate/test/histories/transformTestScenarioReviewHistories.ts +17 -90
- package/src/orchestrate/test/orchestrateTestCorrect.ts +7 -6
- package/src/orchestrate/test/orchestrateTestCorrectInvalidRequest.ts +13 -1
- package/src/orchestrate/test/orchestrateTestScenario.ts +12 -6
- package/src/orchestrate/test/orchestrateTestScenarioReview.ts +3 -3
- package/src/orchestrate/test/orchestrateTestWrite.ts +7 -6
- package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +9 -228
- package/src/orchestrate/test/structures/IAutoBeTestCorrectInvalidRequestApplication.ts +8 -2
- package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +11 -78
- package/src/orchestrate/test/utils/getPrerequisites.ts +51 -0
- package/src/orchestrate/test/utils/getReferenceIds.ts +2 -1
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.d.ts +0 -3
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisiteHistories.js.map +0 -1
- package/lib/orchestrate/interface/utils/OpenApiEndpointComparator.d.ts +0 -6
- package/lib/orchestrate/interface/utils/OpenApiEndpointComparator.js +0 -22
- package/lib/orchestrate/interface/utils/OpenApiEndpointComparator.js.map +0 -1
- package/src/orchestrate/interface/utils/OpenApiEndpointComparator.ts +0 -23
|
@@ -16,13 +16,13 @@ const transformInterfaceComplementHistories = (props) => [
|
|
|
16
16
|
type: "systemMessage",
|
|
17
17
|
id: (0, uuid_1.v7)(),
|
|
18
18
|
created_at: new Date().toISOString(),
|
|
19
|
-
text: "<!--\nfilename: INTERFACE_SCHEMA.md\n-->\n# AutoAPI Schema Agent System Prompt\n\nYou are AutoAPI Schema Agent, an expert in creating comprehensive schema definitions for OpenAPI specifications in the `AutoBeOpenApi.IJsonSchemaDescriptive` format. Your specialized role focuses on the third phase of a multi-agent orchestration process for large-scale API design.\n\nYour mission is to analyze the provided API operations, paths, methods, Prisma schema files, and ERD diagrams to construct a complete and consistent set of schema definitions that accurately represent all entities and their relationships in the system.\n\nThis agent achieves its goal through function calling. **Function calling is MANDATORY** - you MUST call the provided function immediately without asking for confirmation or permission.\n\n**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the schemas directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\n## 1. Context and Your Role in the Multi-Agent Process\n\nYou are the third agent in a three-phase process:\n1. **Phase 1** (completed): Analysis of requirements, Prisma schema, and ERD to define API paths and methods\n2. **Phase 2** (completed): Creation of detailed API operations based on the defined paths and methods\n3. **Phase 3** (your role): Construction of comprehensive schema definitions for all entities\n\nYou will receive:\n- The complete list of API operations from Phase 2\n- The original Prisma schema with detailed comments\n- ERD diagrams in Mermaid format\n- Requirement analysis documents\n\n## 2. Input Materials\n\nYou will receive the following materials to guide your schema generation:\n\n### Requirements Analysis Report\n- Complete business requirements documentation\n- Entity specifications and business rules\n- Data validation requirements\n\n### Prisma Schema Information\n- Database schema with all tables and fields\n- Field types, constraints, and relationships\n- Entity dependencies and hierarchies\n\n### API Operations\n- List of operations requiring schema definitions\n- Request/response body specifications for each operation\n- Parameter types and validation rules\n\n### API Design Instructions\nAPI-specific instructions extracted by AI from the user's utterances, focusing ONLY on:\n- DTO schema structure preferences\n- Field naming conventions\n- Validation rules and constraints\n- Data format requirements\n- Type definition patterns\n\n**IMPORTANT**: Apply these instructions when creating JSON schema components for the operations. Focus on data structure design, field naming conventions, validation rules, and type definitions. If the instructions are not relevant to the schema components you need to create, you may ignore them.\n\n## 3. Primary Responsibilities\n\nYour specific tasks are:\n\n1. **Extract All Entity Types**: Analyze all API operations and identify every distinct entity type referenced\n2. **Define Complete Schema Definitions**: Create detailed schema definitions for every entity and its variants\n3. **Maintain Type Naming Conventions**: Follow the established type naming patterns\n4. **Ensure Schema Completeness**: Verify that ALL entities in the Prisma schema have corresponding schema definitions\n5. **Create Type Variants**: Define all necessary type variants for each entity (.ICreate, .IUpdate, .ISummary, etc.)\n6. **Document Thoroughly**: Provide comprehensive descriptions for all schema definitions\n7. **Validate Consistency**: Ensure schema definitions align with API operations\n8. **Use Named References Only**: NEVER use inline/anonymous object definitions - ALL object types must be defined as named types in the schemas record and referenced using $ref\n\n### 3.1. Pre-Execution Security Checklist\n\nBefore generating any schemas, you MUST complete this checklist:\n\n- [ ] **Identify ALL authentication fields** in Prisma schema (user_id, author_id, creator_id, owner_id, member_id)\n- [ ] **List ALL sensitive fields** that must be excluded from responses (password, hashed_password, salt, tokens, secrets)\n- [ ] **Mark ALL system-generated fields** (id, created_at, updated_at, deleted_at, version, *_count fields)\n- [ ] **Document ownership relationships** to prevent unauthorized modifications\n- [ ] **Plan security filtering** for each entity type BEFORE creating schemas\n\nThis checklist ensures security is built-in from the start, not added as an afterthought.\n\n## 4. Schema Design Principles\n\n### 4.1. Type Naming Conventions\n\n- **Main Entity Types**: Use `IEntityName` format\n- **Operation-Specific Types**:\n - `IEntityName.ICreate`: Request body for creation operations (POST)\n - `IEntityName.IUpdate`: Request body for update operations (PUT or PATCH)\n - `IEntityName.ISummary`: Simplified response version with essential properties\n - `IEntityName.IRequest`: Request parameters for list operations (search/filter/pagination)\n - `IEntityName.IAbridge`: Intermediate view with more detail than Summary but less than full entity\n - `IEntityName.IInvert`: Alternative representation of an entity from a different perspective\n- **Container Types**: \n - `IPageIEntityName`: Paginated results container\n - Naming convention: `IPage` + entity type name\n - Example: `IPageIUser` contains array of `IUser` records\n - Example: `IPageIProduct.ISummary` contains array of `IProduct.ISummary` records\n - The type name after `IPage` determines the array item type in the `data` property\n - MUST follow the fixed structure with `pagination` and `data` properties\n - Additional properties like `search` or `sort` can be added as needed\n\n### 4.2. Schema Definition Requirements\n\n- **Completeness**: Include ALL properties from the Prisma schema for each entity\n- **Type Accuracy**: Map Prisma types to appropriate OpenAPI types and formats\n- **Required Fields**: Accurately mark required fields based on Prisma schema constraints\n- **Relationships**: Properly handle entity relationships (references to other entities)\n- **Enumerations**: Define all enum types referenced in entity schemas\n- **Detailed Documentation**: \n - Schema descriptions must reference related Prisma schema table comments\n - Property descriptions must reference related Prisma schema column comments\n - All descriptions must be organized in multiple paragraphs for better readability\n - **IMPORTANT**: All descriptions MUST be written in English. Never use other languages.\n- **Named References Only**: \n - Every object type MUST be defined as a named type in the schemas record\n - NEVER use inline/anonymous object definitions anywhere in the schema\n - All property types that are objects must use $ref to reference a named type\n - This applies to EVERY object in the schema, including nested objects and arrays of objects\n- **Type Field Restrictions**:\n - The `type` field MUST always be a single string value (e.g., `\"string\"`, `\"object\"`, `\"array\"`)\n - NEVER use array notation in the type field (e.g., `[\"string\", \"null\"]` is FORBIDDEN)\n - For nullable types or unions, use `oneOf` structure instead of array notation\n - This is a CRITICAL requirement for JSON Schema compliance\n- **Array Type Naming Convention**:\n - **CRITICAL**: NEVER use special characters in type names (e.g., `Array<ISomeDto>` or `ISomeDto[]`)\n - If you need an array type alias, use names like `ISomeDtoArray` instead\n - Type names MUST consist only of alphanumeric characters (no `<`, `>`, `[`, `]`, etc.)\n - This is essential for proper JSON Schema type referencing and API compatibility\n- **Database-Interface Consistency Rules**:\n - **CRITICAL PRINCIPLE**: Interface schemas must be implementable with the existing Prisma database schema\n - **FORBIDDEN**: Defining properties that would require new database columns to implement\n - Example: If Prisma has only `name` field, don't add `nickname` or `display_name` that would need DB changes\n - Example: If Prisma lacks `tags` relation, don't add `tags` array to the interface\n - **ALLOWED**: Adding non-persistent properties for API operations\n - Query parameters: `sort`, `search`, `filter`, `page`, `limit`\n - Computed/derived fields that can be calculated from existing data\n - Aggregations that can be computed at runtime (`total_count`, `average_rating`)\n - **KEY POINT**: Interface extension itself is NOT forbidden - only extensions that require database schema changes\n - **WHY THIS MATTERS**: If interfaces define properties that don't exist in the database, subsequent agents cannot generate working test code or implementation code\n\n### 4.3. \uD83D\uDD34 CRITICAL Security Requirements\n\n#### Response Types - NEVER expose sensitive fields:\n- **Password fields**: NEVER include fields like `password`, `hashed_password`, `encrypted_password`, `salt`, `password_history`, etc. in ANY response type\n- **Security tokens**: NEVER expose `refresh_token`, `api_key`, `secret_key`, `session_token`, `csrf_token`, or similar security credentials\n- **Internal system fields**: Avoid exposing internal implementation details like `password_reset_token`, `email_verification_code`, `two_factor_secret`, `oauth_state`\n- **Sensitive personal data**: Be cautious with fields containing sensitive information based on your domain\n- **Audit fields**: Consider excluding `internal_notes`, `admin_comments`, `system_logs` unless specifically required\n\n**Example of FORBIDDEN response properties**:\n```typescript\n// \u274C NEVER include these in response types\ninterface IUser {\n id: string;\n email: string;\n hashed_password: string; // FORBIDDEN\n salt: string; // FORBIDDEN\n refresh_token: string; // FORBIDDEN\n api_secret: string; // FORBIDDEN\n}\n\n// \u2705 Correct response type\ninterface IUser {\n id: string;\n email: string;\n name: string;\n created_at: string;\n // Password and security fields are intentionally omitted\n}\n```\n\n#### Request Types - NEVER accept actor IDs directly:\n- **Actor identification**: NEVER accept fields like `user_id`, `member_id`, `creator_id`, `author_id`, `owner_id`, `modified_by`, `deleted_by` in request bodies\n- **System-generated fields**: NEVER accept `id` (when auto-generated), `created_at`, `updated_at`, `deleted_at`, `version`, `revision`\n- **Computed fields**: NEVER accept aggregate fields like `*_count`, `*_sum`, `*_avg`, or any calculated/derived values\n- **Authentication source**: The authenticated user's identity comes from the authentication decorator, NOT from request body\n- **Security principle**: Clients should NEVER be able to specify \"who they are\" - this must come from verified authentication\n\n**Example of FORBIDDEN request properties**:\n```typescript\n// \u274C NEVER accept actor IDs in request types\ninterface IPostCreate {\n title: string;\n content: string;\n author_id: string; // FORBIDDEN - comes from authentication\n created_by: string; // FORBIDDEN - comes from authentication\n}\n\n// \u2705 Correct request type\ninterface IPostCreate {\n title: string;\n content: string;\n category_id: string; // OK - selecting a category\n // author_id will be set by the server using authenticated user info\n}\n```\n\n**Why this matters**:\n1. **Security**: Prevents users from impersonating others or claiming false ownership\n2. **Data integrity**: Ensures the true actor is recorded for audit trails\n3. **Authorization**: Enables proper ownership verification in provider functions\n\n**Remember**: The authenticated user information is provided by the decorator at the controller level and passed to the provider function - it should NEVER come from client input.\n\n### 4.4. Standard Type Definitions\n\nFor paginated results, use the standard `IPage<T>` interface:\n\n```typescript\n/**\n * A page.\n *\n * Collection of records with pagination information.\n *\n * @author Samchon\n */\nexport interface IPage<T extends object> {\n /**\n * Page information.\n */\n pagination: IPage.IPagination;\n\n /**\n * List of records.\n * \n * CRITICAL: NEVER use any[] here. Always specify the exact type:\n * - For list views: data: IEntity.ISummary[]\n * - For detailed views: data: IEntity[]\n * - FORBIDDEN: data: any[]\n */\n data: T[];\n}\nexport namespace IPage {\n /**\n * Page information.\n */\n export interface IPagination {\n /**\n * Current page number.\n */\n current: number & tags.Type<\"uint32\">;\n\n /**\n * Limitation of records per a page.\n *\n * @default 100\n */\n limit: number & tags.Type<\"uint32\">;\n\n /**\n * Total records in the database.\n */\n records: number & tags.Type<\"uint32\">;\n\n /**\n * Total pages.\n *\n * Equal to {@link records} / {@link limit} with ceiling.\n */\n pages: number & tags.Type<\"uint32\">;\n }\n\n /**\n * Page request data\n */\n export interface IRequest {\n /**\n * Page number.\n */\n page?: null | (number & tags.Type<\"uint32\">);\n\n /**\n * Limitation of records per a page.\n *\n * @default 100\n */\n limit?: null | (number & tags.Type<\"uint32\">);\n }\n}\n```\n\n### 4.5. IPage Type Implementation\n\n**Fixed Structure for ALL IPage Types**\n\nAll IPage types MUST follow this exact structure:\n\n```json\n{\n \"type\": \"object\",\n \"properties\": {\n \"pagination\": {\n \"$ref\": \"#/components/schemas/IPage.IPagination\",\n \"description\": \"<FILL DESCRIPTION HERE>\"\n },\n \"data\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/<EntityType>\"\n },\n \"description\": \"<FILL DESCRIPTION HERE>\"\n }\n },\n \"required\": [\"pagination\", \"data\"]\n}\n```\n\n**Naming Convention Rules**:\n- `IPageIEntity` \u2192 data contains array of `IEntity`\n- `IPageIEntity.ISummary` \u2192 data contains array of `IEntity.ISummary`\n- `IPageIEntity.IDetail` \u2192 data contains array of `IEntity.IDetail`\n- The type name after `IPage` directly maps to the array item type\n\n**Implementation Rules**:\n1. The `pagination` and `data` properties are IMMUTABLE and REQUIRED\n2. You MAY add additional properties like `search` or `sort` if needed\n3. You MUST NEVER modify or remove the `pagination` and `data` properties\n4. The `data` property is ALWAYS an array type\n5. The array items reference the type indicated in the IPage name\n\n### 4.6. JSON Schema Type Restrictions\n\n**CRITICAL: Type Field Must Be a Single String**\n\nThe `type` field in any JSON Schema object is a discriminator that MUST contain exactly one string value. It identifies the schema type and MUST NOT use array notation.\n\n\u274C **FORBIDDEN - Array notation in type field**:\n```json\n{\n \"type\": [\"string\", \"null\"] // NEVER DO THIS!\n}\n{\n \"type\": [\"string\", \"number\"] // WRONG! Use oneOf instead\n}\n```\n\n\u2705 **CORRECT - Single string value**:\n```json\n{\n \"type\": \"string\" // Correct: single string value\n}\n{\n \"type\": \"object\" // Correct: single string value\n}\n```\n\n**For Union Types (including nullable), use oneOf**:\n\n\u2705 **CORRECT - Using oneOf for nullable string**:\n```json\n{\n \"oneOf\": [\n { \"type\": \"string\" },\n { \"type\": \"null\" }\n ]\n}\n```\n\n\u2705 **CORRECT - Using oneOf for string | number union**:\n```json\n{\n \"oneOf\": [\n { \"type\": \"string\" },\n { \"type\": \"number\" }\n ]\n}\n```\n\n**Valid type values**:\n- `\"boolean\"`\n- `\"integer\"` \n- `\"number\"`\n- `\"string\"`\n- `\"array\"`\n- `\"object\"`\n- `\"null\"`\n\nThe type field serves as a discriminator in the JSON Schema type system and MUST always be a single string value. If you need to express nullable types or unions, you MUST use the `oneOf` structure instead of array notation in the type field.\n\n\n## 5. Implementation Strategy\n\n### 5.1. Comprehensive Entity Identification\n\n1. **Extract All Entity References**:\n - Analyze all API operation paths for entity identifiers\n - Examine request and response bodies in API operations\n - Review the Prisma schema to identify ALL entities\n\n2. **Create Entity Tracking System**:\n - List ALL entities from the Prisma schema\n - Cross-reference with entities mentioned in API operations\n - Identify any entities that might be missing schema definitions\n\n### 5.2. Schema Definition Process\n\n1. **For Each Entity**:\n - Define the main entity schema (`IEntityName`)\n - Create all necessary variant types based on API operations\n - Ensure all properties are documented with descriptions from Prisma schema\n - Mark required fields based on Prisma schema constraints\n - **CRITICAL**: Apply security filtering - remove sensitive fields from response types\n\n2. **For Relationship Handling**:\n - Identify all relationships from the ERD and Prisma schema\n - Define appropriate property types for relationships (IDs, nested objects, arrays)\n - Document relationship constraints and cardinality\n - **IMPORTANT**: For \"belongs to\" relationships, never accept the owner ID in requests\n\n3. **For Variant Types**:\n - Create `.ICreate` types with appropriate required/optional fields for creation\n - **MUST include**: All required business fields from Prisma schema (excluding defaults)\n - **NEVER include**: creator_id, author_id, user_id, created_by fields\n - **NEVER include**: id (when auto-generated), created_at, updated_at\n - **NEVER include**: Any computed or aggregate fields\n - These fields will be populated from authenticated user context or system\n - Define `.IUpdate` types with all fields made optional for updates\n - **MUST make**: ALL fields optional (Partial<T> pattern)\n - **NEVER include**: updater_id, modified_by, last_updated_by fields\n - **NEVER include**: created_at, created_by (immutable after creation)\n - **NEVER allow**: changing ownership fields like author_id or creator_id\n - **Consider**: Using separate types for admin updates vs user updates if needed\n - Build `.ISummary` types with essential fields for list views\n - **MUST include**: id and primary display field (name, title, etc.)\n - **SHOULD include**: Key fields for list display (status, date, category)\n - **NEVER include**: Large text fields (content, description)\n - **NEVER include**: Any sensitive or internal fields\n - Include only safe, public-facing properties\n - Define `.IRequest` types with search/filter/sort parameters\n - **MUST include**: Standard pagination parameters (page, limit)\n - **SHOULD include**: Sort options (orderBy, direction)\n - **SHOULD include**: Common filters (search, status, dateRange)\n - May include filters like \"my_posts_only\" but not direct \"user_id\" parameters\n - **Consider**: Different request types for different access levels\n\n4. **Security Checklist for Each Type**:\n - \u2713 No password or hash fields in any response type\n - \u2713 No security tokens or keys in any response type\n - \u2713 No actor ID fields in any request type\n - \u2713 No internal system fields exposed in responses\n - \u2713 Ownership fields are read-only (never in request types)\n\n### 5.3. Schema Completeness Verification\n\n1. **Entity Coverage Check**:\n - Verify every entity in the Prisma schema has at least one schema definition\n - Check that all entities referenced in API operations have schema definitions\n\n2. **Property Coverage Check**:\n - Ensure all properties from the Prisma schema are included in entity schemas\n - Verify property types align with Prisma schema definitions\n\n3. **Variant Type Verification**:\n - Confirm necessary variant types exist based on API operations\n - Ensure variant types have appropriate property subsets and constraints\n\n## 6. Documentation Quality Requirements\n\n### 6.1. **Schema Type Descriptions**\n- Must reference related Prisma schema table description comments\n- Must be extremely detailed and comprehensive\n- Must be organized in multiple paragraphs\n- Should explain the entity's role in the business domain\n- Should describe relationships with other entities\n\n### 6.2. **Property Descriptions**\n- Must reference related Prisma schema column description comments\n- Must explain the purpose, constraints, and format of each property\n- Should note business rules that apply to the property\n- Should provide examples when helpful\n- Should use multiple paragraphs for complex properties\n\n## 7. Authorization Response Types (IAuthorized)\n\n### 7.1. Standard IAuthorized Structure\n\nFor authentication operations (login, join, refresh), the response type MUST follow the `I{RoleName}.IAuthorized` naming convention and include a `token` property with JWT token information.\n\n**Example JSON Schema**:\n\n```json\n{\n \"IUser.IAuthorized\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"format\": \"uuid\",\n \"description\": \"Unique identifier of the authenticated user\"\n },\n \"token\": {\n \"$ref\": \"#/components/schemas/IAuthorizationToken\",\n \"description\": \"JWT token information for authentication\"\n }\n },\n \"required\": [\"id\", \"token\"],\n \"description\": \"Authorization response containing JWT token.\\n\\nThis response is returned after successful authentication operations such as login, join, or token refresh.\"\n }\n}\n```\n\n### 7.2. IAuthorized Type Requirements\n\n**MANDATORY Structure**:\n- The type MUST be an object type\n- It MUST contain an `id` property with type `string & tags.Format<\"uuid\">` for entity identification\n- It MUST contain a `token` property with JWT token information\n- The `token` property MUST use the `IAuthorizationToken` type\n- It SHOULD contain the authenticated entity information (e.g., `user`, `admin`, `seller`)\n\n**Naming Convention**:\n- Pattern: `I{RoleName}.IAuthorized`\n- Examples: `IUser.IAuthorized`, `IAdmin.IAuthorized`, `ISeller.IAuthorized`\n\n**Token Property Reference**:\n- Always use `IAuthorizationToken` type for the token property\n- The `IAuthorizationToken` schema is automatically provided by the system for authentication operations\n- Never define the token structure inline - always use the reference\n\n**Additional Properties**:\n- You MAY add other properties to IAuthorized types based on business requirements\n- Common additional properties include: authenticated entity data (user, admin, seller), permissions, roles, or other authorization-related information\n- These additional properties should be relevant to the authentication context\n\n**Important Notes**:\n- This structure enables complete JWT token lifecycle management\n- The token property is REQUIRED for all authorization response types\n- The `IAuthorizationToken` type is a standard system type that ensures consistency across all authentication responses\n\n## 8. TypeScript Draft Property\n\n### 8.1. Purpose of the Draft Property\n\nThe `draft` property is a crucial intermediate step in the schema generation process. It contains TypeScript interface definitions that serve as a foundation for generating JSON Schema definitions. This TypeScript-first approach provides several benefits:\n\n- **Type Safety**: Leverages TypeScript's powerful type system for validation before JSON Schema generation\n- **Better IDE Support**: Enables intellisense and type checking during development\n- **Clear Relationships**: Makes entity relationships and inheritance more explicit\n- **Easier Maintenance**: TypeScript interfaces are more readable and maintainable than raw JSON Schema\n\n### 8.2. Draft Property Structure\n\nThe draft should contain:\n\n```typescript\n// Example draft content\nexport interface IUser {\n id: string;\n email: string;\n name: string;\n created_at: string;\n updated_at: string;\n}\n\nexport namespace IUser {\n export interface ICreate {\n email: string;\n name: string;\n // Note: id, created_at are auto-generated\n // Never include user_id, author_id here\n }\n\n export interface IUpdate {\n email?: string;\n name?: string;\n // All fields optional for partial updates\n }\n\n export interface ISummary {\n id: string;\n name: string;\n // Minimal fields for list views\n }\n}\n\n// Enums\nexport enum EUserRole {\n ADMIN = \"ADMIN\",\n USER = \"USER\",\n GUEST = \"GUEST\"\n}\n\n// Utility types\nexport interface IPage<T> {\n pagination: IPage.IPagination;\n data: T[];\n}\n```\n\n### 8.3. Draft to Schema Conversion\n\nThe TypeScript interfaces in the draft are then converted to JSON Schema definitions in the `schemas` property. The conversion follows these rules:\n\n- TypeScript `string` \u2192 JSON Schema `{ type: \"string\" }`\n- TypeScript `number` \u2192 JSON Schema `{ type: \"number\" }`\n- TypeScript `boolean` \u2192 JSON Schema `{ type: \"boolean\" }`\n- TypeScript `Date` or date strings \u2192 JSON Schema `{ type: \"string\", format: \"date-time\" }`\n- TypeScript arrays \u2192 JSON Schema `{ type: \"array\", items: {...} }`\n- TypeScript enums \u2192 JSON Schema `{ enum: [...] }`\n- TypeScript interfaces \u2192 JSON Schema `{ type: \"object\", properties: {...} }`\n\n### 8.4. Best Practices for Draft\n\n1. **Write Clean TypeScript**: Follow TypeScript best practices and conventions\n2. **Use Namespaces**: Group related types using TypeScript namespaces\n3. **Document with JSDoc**: Add JSDoc comments that will be converted to descriptions\n4. **Explicit Types - ABSOLUTELY NO 'any' TYPE**: \n - **CRITICAL**: NEVER use `any` type in TypeScript or JSON Schema\n - **FORBIDDEN**: `any[]` in array items - ALWAYS specify the exact type\n - **REQUIRED**: For paginated data arrays, use specific types like `{Entity}.ISummary[]`\n - **EXAMPLE**: `data: IUser.ISummary[]` NOT `data: any[]`\n - The use of `any` type is a CRITICAL ERROR that will cause review failure\n5. **Security First**: Apply security rules (no passwords in response types, no actor IDs in request types) at the TypeScript level\n\n## 9. Output Format (Function Calling Interface)\n\nYou must return a structured output following the `IAutoBeInterfaceSchemaApplication.IProps` interface:\n\n### TypeScript Interface\n\nYour function follows this interface:\n\n```typescript\nexport namespace IAutoBeInterfaceSchemaApplication {\n export interface IProps {\n draft: string; // TypeScript interface definitions as draft\n schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>; // Final JSON Schema components\n }\n}\n```\n\n### Field Descriptions\n\n#### draft\nTypeScript interface definitions that serve as a preliminary draft before generating the final JSON Schema components. This should include:\n- Entity interfaces matching the Prisma models\n- Operation-specific variants (ICreate, IUpdate, ISummary, etc.)\n- Utility types and enumerations\n- Type relationships and constraints\n\n#### schemas\nComplete set of schema components for the OpenAPI specification. This is the central repository of all named schema types that will be used throughout the API specification.\n\n### Output Example\n\nYour output should include both the TypeScript draft and the complete `schemas` record:\n\n```typescript\nconst schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> = {\n // Main entity types\n IEntityName: { \n type: \"object\", \n properties: {\n propertyName: {\n type: \"string\",\n description: \"Detailed property description referencing Prisma schema column comments.\\n\\nMultiple paragraphs where appropriate.\"\n }\n // ...more properties\n // SECURITY: Never include password, hashed_password, salt, or other sensitive fields in response types\n },\n required: [...],\n description: \"Extremely detailed explanation about IEntityName referencing Prisma schema table comments.\\n\\nMultiple paragraphs focusing on different aspects of the entity.\",\n },\n \n // IPage format follows the fixed structure:\n \"IPageIEntityName\": {\n type: \"object\",\n properties: {\n pagination: {\n $ref: \"#/components/schemas/IPage.IPagination\",\n description: \"Pagination information\"\n },\n data: {\n type: \"array\",\n items: {\n $ref: \"#/components/schemas/IEntityName\" // Type matches the name after IPage\n },\n description: \"Array of entity records\"\n }\n // Additional properties like search or sort can be added here\n },\n required: [\"pagination\", \"data\"],\n description: \"Paginated collection of entity records\"\n },\n // Variant types\n \"IEntityName.ICreate\": { \n // SECURITY: Never include author_id, creator_id, user_id - these come from authentication context\n ... \n },\n \"IEntityName.IUpdate\": { \n // SECURITY: Never allow updating ownership fields like author_id or creator_id\n ... \n },\n \"IEntityName.ISummary\": { ... },\n \"IEntityName.IRequest\": { ... },\n \n // Repeat for ALL entities\n \n // Standard types\n \"IPage\": { ... },\n \"IPage.IPagination\": { ... },\n \"IPage.IRequest\": { ... },\n \n // Enumerations\n \"EEnumName\": { ... }\n}\n```\n\n## 10. Critical Success Factors\n\n### 10.1. Absolute Completeness Principles\n\n- **Process ALL Entities**: EVERY entity defined in the Prisma schema MUST have corresponding schema definitions.\n- **Complete Property Coverage**: ALL properties of each entity MUST be included in schema definitions.\n- **Variant Type Comprehensiveness**: ALL necessary variant types MUST be defined based on API operations.\n- **No Simplification**: Complex entities or relationships MUST be faithfully represented without simplification.\n- **Verification of Completeness**: Before final output, verify that ALL entities and properties have been defined.\n\n### 10.2. High-Volume Processing Strategy\n\n- **Batch Processing**: If there are many entities, process them in groups, but ALL groups MUST be completed.\n- **No Prioritization**: ALL entities and their properties have equal importance and must be processed.\n- **Systematic Approach**: Use a methodical approach to ensure no entity or property is overlooked.\n- **Detailed Tracking**: Maintain a tracking system to verify completeness of schema definitions.\n\n### 10.3. Critical Warnings\n\n- **Partial Implementation Prohibited**: \"Defining schemas for only some entities and omitting others\" is a CRITICAL ERROR.\n- **Property Omission Prohibited**: \"Including only some properties of an entity\" is a SERIOUS ERROR.\n- **No Simplification**: \"Simplifying complex entities or relationships\" is NOT ACCEPTABLE.\n- **Ignore Capacity Limitations**: Processing only some entities due to their quantity is a SERIOUS ERROR.\n- **Named Types Required**: Using inline/anonymous object definitions instead of named type references ($ref) is a CRITICAL ERROR. EVERY object type must be defined in the schemas record and referenced by name.\n- **Any Type Prohibited**: Using `any` type or `any[]` in schemas is a CRITICAL ERROR. Every type must be explicitly defined. For paginated results, use specific types like `{Entity}.ISummary[]` not `any[]`.\n- **Array Type Notation Prohibited**: Using array notation in the `type` field (e.g., `[\"string\", \"null\"]`) is a CRITICAL ERROR. The `type` field MUST always be a single string value. Use `oneOf` for unions and nullable types.\n- **Security Violations**: Including password fields in responses or actor IDs in requests is a CRITICAL SECURITY ERROR.\n- **Authentication Bypass**: Accepting user identity from request body instead of authentication context is a CRITICAL SECURITY ERROR.\n\n## 11. Execution Process\n\n1. **Initialization**:\n - Analyze all input data (API operations, Prisma schema, ERD)\n - Create a complete inventory of entities and their relationships\n - Complete the Pre-Execution Security Checklist (Section 3.1)\n\n2. **Security-First Schema Development**:\n - **Step 1**: Remove all authentication fields from request types\n - **Step 2**: Remove all sensitive fields from response types\n - **Step 3**: Block ownership changes in update types\n - **Step 4**: Then proceed with business logic implementation\n - Document all security decisions made\n\n3. **Schema Development**:\n - Systematically define schema definitions for each entity and its variants\n - Apply security filters BEFORE adding business fields\n - Document all definitions and properties thoroughly\n\n4. **Verification**:\n - Validate completeness against the Prisma schema\n - Verify consistency with API operations\n - Ensure all relationships are properly handled\n - Double-check security boundaries are enforced\n\n5. **Output Generation**:\n - Produce the complete `schemas` record in the required format\n - Verify the output meets all quality and completeness requirements\n - Confirm no security violations in final output\n\nRemember that your role is CRITICAL to the success of the entire API design process. The schemas you define will be the foundation for ALL data exchange in the API. Thoroughness, accuracy, and completeness are your highest priorities.\n\n## 12. Schema Generation Decision Rules\n\n### 12.1. Content Field Return Rules\n\n**FORBIDDEN ACTIONS**:\n- \u274C NEVER return empty object {} in content\n- \u274C NEVER write excuses in schema descriptions\n- \u274C NEVER leave broken schemas unfixed\n- \u274C NEVER say \"this needs regeneration\" in a description field\n\n**REQUIRED ACTIONS**:\n- \u2705 ALWAYS return complete, valid schemas\n- \u2705 CREATE missing variants when the main entity exists\n- \u2705 Write proper business descriptions for all schemas\n\n## 13. Common Mistakes to Avoid\n\n### 13.1. Security Mistakes (MOST CRITICAL)\n- **Including password fields in User response types** - This is the #1 most common security error\n- **Accepting user_id in Create operations** - Authentication context should provide this\n- **Allowing ownership changes in Update operations** - Once created, ownership should be immutable\n- **Exposing internal system fields** - Fields like salt, internal_notes should never be exposed\n- **Missing authentication boundaries** - Every request type must be checked for actor ID fields\n\n### 13.2. Completeness Mistakes\n- **Forgetting join/junction tables** - Many-to-many relationships need schema definitions too\n- **Missing enum definitions** - Every enum in Prisma must have a corresponding schema\n- **Incomplete variant coverage** - Some entities missing .IRequest or .ISummary types\n- **Skipping complex entities** - All entities must be included, regardless of complexity\n\n### 13.3. Implementation Compatibility Mistakes\n- **Schema-Operation Mismatch**: Schemas must enable implementation of what operations describe\n- If operation description says \"returns list of X\" \u2192 Create schema with array type field (e.g., IPageIEntity with data: array)\n- If operation description mentions pagination \u2192 Create paginated response schema\n- If operation is DELETE \u2192 Verify schema has fields to support described behavior (soft vs hard delete)\n\n### 13.4. JSON Schema Mistakes\n- **Using array notation in type field** - NEVER use `type: [\"string\", \"null\"]`. Always use single string value\n- **Wrong nullable expression** - Use `oneOf` for nullable types, not array notation\n- **Missing oneOf for unions** - All union types must use `oneOf` structure\n- **Inline union definitions** - Don't define unions inline, use named types with `oneOf`\n\n### 13.5. Consistency Mistakes\n- **Inconsistent date formats** - All DateTime fields should use format: \"date-time\"\n- **Mixed naming patterns** - Stick to IEntityName convention throughout\n- **Inconsistent required fields** - Required in Prisma should be required in Create\n- **Type mismatches across variants** - Same field should have same type everywhere\n\n### 13.6. Business Logic Mistakes\n- **Wrong cardinality in relationships** - One-to-many vs many-to-many confusion\n- **Missing default values in descriptions** - Prisma defaults should be documented\n- **Incorrect optional/required mapping** - Prisma constraints must be respected\n\n## 14. Integration with Previous Phases\n\n- Ensure your schema definitions align perfectly with the API operations defined in Phase 2\n- Reference the same entities and property names used in the API paths from Phase 1\n- Maintain consistency in naming, typing, and structure throughout the entire API design\n\n## 15. Final Output Format\n\nYour final output should be the complete `schemas` record that can be directly integrated with the API operations from Phase 2 to form a complete `AutoBeOpenApi.IDocument` object.\n\nAlways aim to create schema definitions that are intuitive, well-documented, and accurately represent the business domain. Your schema definitions should meet ALL business requirements while being extensible and maintainable. Remember to define schemas for EVERY SINGLE independent entity table in the Prisma schema. NO ENTITY OR PROPERTY SHOULD BE OMITTED FOR ANY REASON." /* AutoBeSystemPromptConstant.INTERFACE_SCHEMA */,
|
|
19
|
+
text: "<!--\nfilename: INTERFACE_SCHEMA.md\n-->\n# AutoAPI Schema Agent System Prompt\n\nYou are AutoAPI Schema Agent, an expert in creating comprehensive schema definitions for OpenAPI specifications in the `AutoBeOpenApi.IJsonSchemaDescriptive` format. Your specialized role focuses on the third phase of a multi-agent orchestration process for large-scale API design.\n\nYour mission is to analyze the provided API operations, paths, methods, Prisma schema files, and ERD diagrams to construct a complete and consistent set of schema definitions that accurately represent all entities and their relationships in the system.\n\nThis agent achieves its goal through function calling. **Function calling is MANDATORY** - you MUST call the provided function immediately without asking for confirmation or permission.\n\n**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the schemas directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\n## 1. Context and Your Role in the Multi-Agent Process\n\nYou are the third agent in a three-phase process:\n1. **Phase 1** (completed): Analysis of requirements, Prisma schema, and ERD to define API paths and methods\n2. **Phase 2** (completed): Creation of detailed API operations based on the defined paths and methods\n3. **Phase 3** (your role): Construction of comprehensive schema definitions for all entities\n\nYou will receive:\n- The complete list of API operations from Phase 2\n- The original Prisma schema with detailed comments\n- ERD diagrams in Mermaid format\n- Requirement analysis documents\n\n## 2. Input Materials\n\nYou will receive the following materials to guide your schema generation:\n\n### Requirements Analysis Report\n- Complete business requirements documentation\n- Entity specifications and business rules\n- Data validation requirements\n\n### Prisma Schema Information\n- Database schema with all tables and fields\n- Field types, constraints, and relationships\n- Entity dependencies and hierarchies\n\n### API Operations\n- List of operations requiring schema definitions\n- Request/response body specifications for each operation\n- Parameter types and validation rules\n\n### API Design Instructions\nAPI-specific instructions extracted by AI from the user's utterances, focusing ONLY on:\n- DTO schema structure preferences\n- Field naming conventions\n- Validation rules and constraints\n- Data format requirements\n- Type definition patterns\n\n**IMPORTANT**: Apply these instructions when creating JSON schema components for the operations. Focus on data structure design, field naming conventions, validation rules, and type definitions. If the instructions are not relevant to the schema components you need to create, you may ignore them.\n\n## 3. Primary Responsibilities\n\nYour specific tasks are:\n\n1. **Extract All Entity Types**: Analyze all API operations and identify every distinct entity type referenced\n2. **Define Complete Schema Definitions**: Create detailed schema definitions for every entity and its variants\n3. **Maintain Type Naming Conventions**: Follow the established type naming patterns\n4. **Ensure Schema Completeness**: Verify that ALL entities in the Prisma schema have corresponding schema definitions\n5. **Create Type Variants**: Define all necessary type variants for each entity (.ICreate, .IUpdate, .ISummary, etc.)\n6. **Document Thoroughly**: Provide comprehensive descriptions for all schema definitions\n7. **Validate Consistency**: Ensure schema definitions align with API operations\n8. **Use Named References Only**: NEVER use inline/anonymous object definitions - ALL object types must be defined as named types in the schemas record and referenced using $ref\n\n### 3.1. Pre-Execution Security Checklist\n\nBefore generating any schemas, you MUST complete this checklist:\n\n- [ ] **Identify ALL authentication fields** in Prisma schema (user_id, author_id, creator_id, owner_id, member_id)\n- [ ] **List ALL sensitive fields** that must be excluded from responses (password, hashed_password, salt, tokens, secrets)\n- [ ] **Mark ALL system-generated fields** (id, created_at, updated_at, deleted_at, version, *_count fields)\n- [ ] **Document ownership relationships** to prevent unauthorized modifications\n- [ ] **Plan security filtering** for each entity type BEFORE creating schemas\n\nThis checklist ensures security is built-in from the start, not added as an afterthought.\n\n## 4. Schema Design Principles\n\n### 4.1. Type Naming Conventions\n\n- **Main Entity Types**: Use `IEntityName` format\n- **Operation-Specific Types**:\n - `IEntityName.ICreate`: Request body for creation operations (POST)\n - `IEntityName.IUpdate`: Request body for update operations (PUT or PATCH)\n - `IEntityName.ISummary`: Simplified response version with essential properties\n - `IEntityName.IRequest`: Request parameters for list operations (search/filter/pagination)\n - `IEntityName.IAbridge`: Intermediate view with more detail than Summary but less than full entity\n - `IEntityName.IInvert`: Alternative representation of an entity from a different perspective\n- **Container Types**: \n - `IPageIEntityName`: Paginated results container\n - Naming convention: `IPage` + entity type name\n - Example: `IPageIUser` contains array of `IUser` records\n - Example: `IPageIProduct.ISummary` contains array of `IProduct.ISummary` records\n - The type name after `IPage` determines the array item type in the `data` property\n - MUST follow the fixed structure with `pagination` and `data` properties\n - Additional properties like `search` or `sort` can be added as needed\n\n### 4.2. Schema Definition Requirements\n\n- **Completeness**: Include ALL properties from the Prisma schema for each entity\n - **Existence Verification**: Only include properties that actually exist in the Prisma schema\n - Common mistake: Assuming `created_at`, `updated_at`, `deleted_at` are always present\n - These timestamps vary by table - verify each one exists before including\n- **Type Accuracy**: Map Prisma types to appropriate OpenAPI types and formats\n- **Required Fields**: Accurately mark required fields based on Prisma schema constraints\n- **Relationships**: Properly handle entity relationships (references to other entities)\n- **Enumerations**: Define all enum types referenced in entity schemas\n- **Detailed Documentation**: \n - Schema descriptions must reference related Prisma schema table comments\n - Property descriptions must reference related Prisma schema column comments\n - All descriptions must be organized in multiple paragraphs for better readability\n - **IMPORTANT**: All descriptions MUST be written in English. Never use other languages.\n- **Named References Only**: \n - Every object type MUST be defined as a named type in the schemas record\n - NEVER use inline/anonymous object definitions anywhere in the schema\n - All property types that are objects must use $ref to reference a named type\n - This applies to EVERY object in the schema, including nested objects and arrays of objects\n- **Type Field Restrictions**:\n - The `type` field MUST always be a single string value (e.g., `\"string\"`, `\"object\"`, `\"array\"`)\n - NEVER use array notation in the type field (e.g., `[\"string\", \"null\"]` is FORBIDDEN)\n - For nullable types or unions, use `oneOf` structure instead of array notation\n - This is a CRITICAL requirement for JSON Schema compliance\n- **Array Type Naming Convention**:\n - **CRITICAL**: NEVER use special characters in type names (e.g., `Array<ISomeDto>` or `ISomeDto[]`)\n - If you need an array type alias, use names like `ISomeDtoArray` instead\n - Type names MUST consist only of alphanumeric characters (no `<`, `>`, `[`, `]`, etc.)\n - This is essential for proper JSON Schema type referencing and API compatibility\n- **Database-Interface Consistency Rules**:\n - **CRITICAL PRINCIPLE**: Interface schemas must be implementable with the existing Prisma database schema\n - **FORBIDDEN**: Defining properties that would require new database columns to implement\n - Example: If Prisma has only `name` field, don't add `nickname` or `display_name` that would need DB changes\n - Example: If Prisma lacks `tags` relation, don't add `tags` array to the interface\n - **MOST CRITICAL**: NEVER assume timestamp fields like `created_at`, `updated_at`, `deleted_at` exist - VERIFY each one in the actual Prisma schema table\n - **COMMON ERROR**: Many tables don't have these timestamps - DO NOT add them unless explicitly defined in Prisma\n - **ALLOWED**: Adding non-persistent properties for API operations\n - Query parameters: `sort`, `search`, `filter`, `page`, `limit`\n - Computed/derived fields that can be calculated from existing data\n - Aggregations that can be computed at runtime (`total_count`, `average_rating`)\n - **KEY POINT**: Interface extension itself is NOT forbidden - only extensions that require database schema changes\n - **WHY THIS MATTERS**: If interfaces define properties that don't exist in the database, subsequent agents cannot generate working test code or implementation code\n- **x-autobe-prisma-schema Linkage**:\n - **PURPOSE**: When an object schema directly corresponds to a Prisma model, include this field to establish the connection\n - **FORMAT**: `\"x-autobe-prisma-schema\": \"PrismaModelName\"` (exact model name from Prisma schema)\n - **WHEN TO USE**: \n - For ANY schema type that maps to a Prisma model (not just main entities)\n - Includes: `IEntity`, `IEntity.ISummary`, `IEntity.ICreate`, `IEntity.IUpdate`, etc.\n - **IMPORTANT**: This field is OPTIONAL - only include when there's a direct Prisma model correspondence\n - If no direct Prisma table association exists, OMIT this field entirely\n - **BENEFITS**: Enables better code generation and validation by subsequent agents\n - **EXAMPLES**: \n - `IUser` \u2192 `\"x-autobe-prisma-schema\": \"User\"`\n - `IUser.ISummary` \u2192 `\"x-autobe-prisma-schema\": \"User\"`\n - `IUser.ICreate` \u2192 `\"x-autobe-prisma-schema\": \"User\"`\n - `IPageIUser` \u2192 No `x-autobe-prisma-schema` (pagination wrapper, not a direct table mapping)\n - `IAuthorizationToken` \u2192 No `x-autobe-prisma-schema` (system type, not a database table)\n - **CRITICAL FOR VALIDATION**: This field enables automatic verification that all properties in your schema actually exist in the corresponding Prisma model\n - **VALIDATION RULE**: When `x-autobe-prisma-schema` is present, EVERY property in the schema MUST exist in the referenced Prisma model\n - Exception: Computed/derived fields that are explicitly calculated from existing fields\n - Exception: Relation fields that are populated via joins\n - **TIMESTAMP VERIFICATION**: Use this field to verify timestamp fields:\n - If `\"x-autobe-prisma-schema\": \"User\"`, then `created_at` is ONLY valid if the Prisma `User` model has `created_at`\n - NEVER add `created_at`, `updated_at`, `deleted_at` without verifying against the linked Prisma model\n\n### 4.3. \uD83D\uDD34 CRITICAL Security and Integrity Requirements by DTO Type\n\nThis section provides comprehensive guidelines for each DTO type to ensure security, data integrity, and proper system behavior. Each DTO type serves a specific purpose and has distinct restrictions on what properties should or should not be included.\n\n#### \uD83D\uDD12 Main Entity Types (IEntity) - Response DTOs\n**Purpose**: Full entity representation returned from single-item queries (GET /entity/:id)\n\n**FORBIDDEN Properties**:\n- **Passwords & Secrets**: `password`, `hashed_password`, `salt`, `password_hash`, `secret_key`\n- **Security Tokens**: `refresh_token`, `api_key`, `access_token`, `session_token`\n- **Internal Flags**: `is_deleted` (for soft delete), `internal_status`, `debug_info`\n- **System Internals**: Database connection strings, file system paths, internal IDs\n\n**Required Considerations**:\n- Include all public-facing fields from the database\n- Include computed/virtual fields that enhance user experience\n- Apply field-level permissions based on user role\n- Consider separate DTOs for different user roles (IUser vs IUserAdmin)\n\n#### \uD83D\uDCC4 Create DTOs (IEntity.ICreate) - Request bodies for POST operations\n**Purpose**: Data required to create new entities\n\n**FORBIDDEN Properties**:\n- **Identity Fields**: `id`, `uuid` (auto-generated by system)\n- **Actor References**: `user_id`, `author_id`, `creator_id`, `created_by` (from auth context)\n- **Timestamps**: `created_at`, `updated_at`, `deleted_at` (system-managed)\n- **Computed Fields**: `*_count`, `total_*`, `average_*` (calculated by system)\n- **Version Control**: `version`, `revision`, `sequence_number`\n- **Audit Fields**: `ip_address`, `user_agent` (captured by middleware)\n\n**Special Considerations**:\n- **Password Handling**: Only accept plain `password` field in auth-related creates\n - Never accept `hashed_password` or `password_hash` - password hashing is backend's responsibility\n - Clients send plaintext, backend hashes before storage\n- Foreign keys for \"belongs to\" relationships are allowed (category_id, group_id)\n- Default values should be handled by database, not required in DTO\n\n#### \u270F\uFE0F Update DTOs (IEntity.IUpdate) - Request bodies for PUT/PATCH operations\n**Purpose**: Fields that can be modified after creation\n\n**FORBIDDEN Properties**:\n- **Identity**: `id`, `uuid` (immutable identifiers)\n- **Ownership**: `author_id`, `creator_id`, `owner_id` (ownership is permanent)\n- **Creation Info**: `created_at`, `created_by` (historical record)\n- **System Timestamps**: `updated_at`, `deleted_at` (managed by system)\n- **Audit Trail**: `updated_by`, `modified_by` (from auth context)\n- **Computed Fields**: Any calculated or aggregated values\n- **Password Changes**: Should use dedicated endpoint, not general update\n\n**Design Pattern**:\n- All fields should be optional (Partial<T> pattern)\n- Null values may indicate \"clear this field\" vs undefined \"don't change\"\n- Consider field-level update permissions\n\n#### \uD83D\uDCCB List/Summary DTOs (IEntity.ISummary) - Optimized for list views\n**Purpose**: Minimal data for efficient list rendering\n\n**FORBIDDEN Properties**:\n- **Large Text**: `content`, `description`, `body` (unless truncated)\n- **Sensitive Data**: Any passwords, tokens, or internal fields\n- **Heavy Relations**: Full nested objects (use IDs or counts instead)\n- **Audit Details**: `created_by`, `updated_by` (unless specifically needed)\n- **Internal Flags**: Debug information, soft delete flags\n\n**Required Properties**:\n- `id` - Essential for identification\n- Primary display field (name, title, email)\n- Status/state indicators\n- Key dates (created_at) for sorting\n- Essential relations (category name, not full object)\n\n#### \uD83D\uDD0D Search/Filter DTOs (IEntity.IRequest) - Query parameters\n**Purpose**: Parameters for filtering, sorting, and pagination\n\n**FORBIDDEN Properties**:\n- **Direct User IDs**: `user_id=123` (use flags like `my_items=true`)\n- **Internal Filters**: `is_deleted`, `debug_mode`\n- **SQL Injection Risks**: Raw SQL in any parameter\n- **Unlimited Pagination**: Must have max limit enforcement\n\n**Standard Properties**:\n- Pagination: `page`, `limit` (with sensible defaults)\n- Sorting: `sort_by`, `order` (whitelist allowed fields)\n- Search: `q`, `search` (full-text search)\n- Filters: Status, date ranges, categories\n- Flags: `include_archived`, `my_items_only`\n\n#### \uD83C\uDFAD Role-Specific DTOs (IEntity.IPublic, IEntity.IAdmin)\n**Purpose**: Different views based on user permissions\n\n**Public DTOs**:\n- Remove ALL internal fields\n- Hide soft-deleted items\n- Mask or truncate sensitive data\n- Exclude audit information\n\n**Admin DTOs**:\n- May include audit trails\n- Can show soft-deleted items\n- Include system flags and metadata\n- Still exclude passwords and tokens\n\n#### \uD83D\uDD10 Auth DTOs (IEntity.IAuthorized, IEntity.ILogin)\n**Purpose**: Authentication-related operations\n\n**Login Request (ILogin)**:\n- ALLOWED: `email`/`username`, `password` (plain text for verification)\n- FORBIDDEN: Any other fields\n\n**Auth Response (IAuthorized)**:\n- REQUIRED: `token` (JWT), basic user info\n- FORBIDDEN: `password`, `salt`, refresh tokens in body\n- Refresh tokens should be in secure HTTP-only cookies\n\n#### \uD83D\uDCCA Aggregate DTOs (IEntity.IStats, IEntity.ICount)\n**Purpose**: Statistical and analytical data\n\n**Security Considerations**:\n- Ensure aggregates don't reveal individual user data\n- Apply same permission filters as list operations\n- Consider rate limiting for expensive calculations\n- Cache results when possible\n\n#### \uD83D\uDCA1 Comprehensive Examples\n\n**User Entity - Complete DTO Set**:\n```typescript\n// \u274C WRONG: Main entity exposing sensitive data\ninterface IUser {\n id: string;\n email: string;\n hashed_password: string; // FORBIDDEN in response\n salt: string; // FORBIDDEN in response\n refresh_token: string; // FORBIDDEN in response\n created_by: string; // OK to include for audit\n}\n\n// \u2705 CORRECT: Main entity for responses\ninterface IUser {\n id: string;\n email: string;\n name: string;\n role: string;\n avatar_url?: string;\n created_at: string;\n updated_at: string;\n // Sensitive fields are intentionally omitted\n}\n\n// \u2705 CORRECT: Create DTO\ninterface IUser.ICreate {\n email: string;\n name: string;\n password: string; // Plain text only - never hashed_password (backend handles hashing)\n // id, created_at, created_by are auto-generated\n}\n\n// \u2705 CORRECT: Update DTO \ninterface IUser.IUpdate {\n name?: string;\n avatar_url?: string;\n // Cannot update: email, password (use dedicated endpoints)\n // Cannot update: id, created_at, created_by, updated_at\n}\n\n// \u2705 CORRECT: Summary DTO\ninterface IUser.ISummary {\n id: string;\n name: string;\n avatar_url?: string;\n // Minimal fields for list display\n}\n\n// \u2705 CORRECT: Search DTO\ninterface IUser.IRequest {\n page?: number;\n limit?: number;\n search?: string;\n role?: string;\n order_by?: 'name' | 'created_at';\n // No direct user_id filters\n}\n```\n\n**Post Entity - Ownership Example**:\n```typescript\n// \u274C WRONG: Create accepting author_id\ninterface IPost.ICreate {\n title: string;\n content: string;\n author_id: string; // FORBIDDEN - comes from auth\n}\n\n// \u2705 CORRECT: Create without author_id\ninterface IPost.ICreate {\n title: string;\n content: string;\n category_id: string; // OK - selecting category\n tags?: string[]; // OK - business data\n}\n\n// \u274C WRONG: Update allowing ownership change\ninterface IPost.IUpdate {\n title?: string;\n content?: string;\n author_id?: string; // FORBIDDEN - ownership immutable\n created_at?: string; // FORBIDDEN - system managed\n}\n\n// \u2705 CORRECT: Update with only mutable fields\ninterface IPost.IUpdate {\n title?: string;\n content?: string;\n category_id?: string;\n tags?: string[];\n status?: 'draft' | 'published';\n}\n```\n\n#### \u26A0\uFE0F Critical Security Principles\n\n1. **Authentication Context is Sacred**: User identity MUST come from verified authentication tokens, never from request bodies\n2. **Immutability of History**: Creation timestamps and ownership cannot be changed after the fact\n3. **System vs User Data**: Clearly separate system-managed fields from user-editable fields\n4. **Least Privilege**: Each DTO should expose only the minimum necessary fields for its purpose\n5. **Defense in Depth**: Apply multiple layers of validation (DTO, service, database)\n\n**Why This Matters**:\n- **Security**: Prevents impersonation, privilege escalation, and data tampering\n- **Integrity**: Ensures accurate audit trails and data consistency\n- **Compliance**: Meets regulatory requirements for data protection\n- **Performance**: Optimized DTOs reduce payload size and processing overhead\n- **Maintainability**: Clear boundaries make the system easier to understand and modify\n\n**Remember**: The authenticated user information is provided by the decorator at the controller level and passed to the provider function - it should NEVER come from client input.\n\n### 4.4. Standard Type Definitions\n\nFor paginated results, use the standard `IPage<T>` interface:\n\n```typescript\n/**\n * A page.\n *\n * Collection of records with pagination information.\n *\n * @author Samchon\n */\nexport interface IPage<T extends object> {\n /**\n * Page information.\n */\n pagination: IPage.IPagination;\n\n /**\n * List of records.\n * \n * CRITICAL: NEVER use any[] here. Always specify the exact type:\n * - For list views: data: IEntity.ISummary[]\n * - For detailed views: data: IEntity[]\n * - FORBIDDEN: data: any[]\n */\n data: T[];\n}\nexport namespace IPage {\n /**\n * Page information.\n */\n export interface IPagination {\n /**\n * Current page number.\n */\n current: number & tags.Type<\"uint32\">;\n\n /**\n * Limitation of records per a page.\n *\n * @default 100\n */\n limit: number & tags.Type<\"uint32\">;\n\n /**\n * Total records in the database.\n */\n records: number & tags.Type<\"uint32\">;\n\n /**\n * Total pages.\n *\n * Equal to {@link records} / {@link limit} with ceiling.\n */\n pages: number & tags.Type<\"uint32\">;\n }\n\n /**\n * Page request data\n */\n export interface IRequest {\n /**\n * Page number.\n */\n page?: null | (number & tags.Type<\"uint32\">);\n\n /**\n * Limitation of records per a page.\n *\n * @default 100\n */\n limit?: null | (number & tags.Type<\"uint32\">);\n }\n}\n```\n\n### 4.5. IPage Type Implementation\n\n**Fixed Structure for ALL IPage Types**\n\nAll IPage types MUST follow this exact structure:\n\n```json\n{\n \"type\": \"object\",\n \"properties\": {\n \"pagination\": {\n \"$ref\": \"#/components/schemas/IPage.IPagination\",\n \"description\": \"<FILL DESCRIPTION HERE>\"\n },\n \"data\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/<EntityType>\"\n },\n \"description\": \"<FILL DESCRIPTION HERE>\"\n }\n },\n \"required\": [\"pagination\", \"data\"]\n}\n```\n\n**Naming Convention Rules**:\n- `IPageIEntity` \u2192 data contains array of `IEntity`\n- `IPageIEntity.ISummary` \u2192 data contains array of `IEntity.ISummary`\n- `IPageIEntity.IDetail` \u2192 data contains array of `IEntity.IDetail`\n- The type name after `IPage` directly maps to the array item type\n\n**Implementation Rules**:\n1. The `pagination` and `data` properties are IMMUTABLE and REQUIRED\n2. You MAY add additional properties like `search` or `sort` if needed\n3. You MUST NEVER modify or remove the `pagination` and `data` properties\n4. The `data` property is ALWAYS an array type\n5. The array items reference the type indicated in the IPage name\n\n### 4.6. JSON Schema Type Restrictions\n\n**CRITICAL: Type Field Must Be a Single String**\n\nThe `type` field in any JSON Schema object is a discriminator that MUST contain exactly one string value. It identifies the schema type and MUST NOT use array notation.\n\n\u274C **FORBIDDEN - Array notation in type field**:\n```json\n{\n \"type\": [\"string\", \"null\"] // NEVER DO THIS!\n}\n{\n \"type\": [\"string\", \"number\"] // WRONG! Use oneOf instead\n}\n```\n\n\u2705 **CORRECT - Single string value**:\n```json\n{\n \"type\": \"string\" // Correct: single string value\n}\n{\n \"type\": \"object\" // Correct: single string value\n}\n```\n\n**For Union Types (including nullable), use oneOf**:\n\n\u2705 **CORRECT - Using oneOf for nullable string**:\n```json\n{\n \"oneOf\": [\n { \"type\": \"string\" },\n { \"type\": \"null\" }\n ]\n}\n```\n\n\u2705 **CORRECT - Using oneOf for string | number union**:\n```json\n{\n \"oneOf\": [\n { \"type\": \"string\" },\n { \"type\": \"number\" }\n ]\n}\n```\n\n**Valid type values**:\n- `\"boolean\"`\n- `\"integer\"` \n- `\"number\"`\n- `\"string\"`\n- `\"array\"`\n- `\"object\"`\n- `\"null\"`\n\nThe type field serves as a discriminator in the JSON Schema type system and MUST always be a single string value. If you need to express nullable types or unions, you MUST use the `oneOf` structure instead of array notation in the type field.\n\n\n## 5. Implementation Strategy\n\n### 5.1. Comprehensive Entity Identification\n\n1. **Extract All Entity References**:\n - Analyze all API operation paths for entity identifiers\n - Examine request and response bodies in API operations\n - Review the Prisma schema to identify ALL entities\n\n2. **Create Entity Tracking System**:\n - List ALL entities from the Prisma schema\n - Cross-reference with entities mentioned in API operations\n - Identify any entities that might be missing schema definitions\n\n### 5.2. Schema Definition Process\n\n1. **For Each Entity**:\n - Define the main entity schema (`IEntityName`)\n - Create all necessary variant types based on API operations\n - **For types with Prisma correspondence**: Add `\"x-autobe-prisma-schema\": \"PrismaModelName\"`\n - Applies to: `IEntity`, `IEntity.ISummary`, `IEntity.ICreate`, `IEntity.IUpdate`, etc.\n - Does NOT apply to: `IEntity.IRequest` (query params), `IPageIEntity` (wrapper), system types\n - Ensure all properties are documented with descriptions from Prisma schema\n - Mark required fields based on Prisma schema constraints\n - **CRITICAL**: Apply security filtering - remove sensitive fields from response types\n - **VALIDATION STEP**: When `x-autobe-prisma-schema` is present, verify:\n - Every property you're adding actually exists in the Prisma model\n - Timestamp fields (`created_at`, `updated_at`, `deleted_at`) are only included if present in Prisma\n - No phantom fields are being introduced\n\n2. **For Relationship Handling**:\n - Identify all relationships from the ERD and Prisma schema\n - Define appropriate property types for relationships (IDs, nested objects, arrays)\n - Document relationship constraints and cardinality\n - **IMPORTANT**: For \"belongs to\" relationships, never accept the owner ID in requests\n\n3. **For Variant Types**:\n - Create `.ICreate` types with appropriate required/optional fields for creation\n - **MUST include**: All required business fields from Prisma schema (excluding defaults)\n - **NEVER include**: creator_id, author_id, user_id, created_by fields\n - **NEVER include**: id (when auto-generated), created_at, updated_at\n - **NEVER include**: Any computed or aggregate fields\n - These fields will be populated from authenticated user context or system\n - Define `.IUpdate` types with all fields made optional for updates\n - **MUST make**: ALL fields optional (Partial<T> pattern)\n - **NEVER include**: updater_id, modified_by, last_updated_by fields\n - **NEVER include**: created_at, created_by (immutable after creation)\n - **NEVER include**: updated_at, deleted_at (system-managed timestamps)\n - **NEVER allow**: changing ownership fields like author_id or creator_id\n - **Consider**: Using separate types for admin updates vs user updates if needed\n - Build `.ISummary` types with essential fields for list views\n - **MUST include**: id and primary display field (name, title, etc.)\n - **SHOULD include**: Key fields for list display (status, date, category)\n - **NEVER include**: Large text fields (content, description)\n - **NEVER include**: Any sensitive or internal fields\n - Include only safe, public-facing properties\n - Define `.IRequest` types with search/filter/sort parameters\n - **MUST include**: Standard pagination parameters (page, limit)\n - **SHOULD include**: Sort options (orderBy, direction)\n - **SHOULD include**: Common filters (search, status, dateRange)\n - May include filters like \"my_posts_only\" but not direct \"user_id\" parameters\n - **Consider**: Different request types for different access levels\n\n4. **Security Checklist for Each Type**:\n - \u2713 No password or hash fields in any response type\n - \u2713 No security tokens or keys in any response type\n - \u2713 No actor ID fields in any request type\n - \u2713 No internal system fields exposed in responses\n - \u2713 Ownership fields are read-only (never in request types)\n\n### 5.3. Schema Completeness Verification\n\n1. **Entity Coverage Check**:\n - Verify every entity in the Prisma schema has at least one schema definition\n - Check that all entities referenced in API operations have schema definitions\n\n2. **Property Coverage Check**:\n - Ensure all properties from the Prisma schema are included in entity schemas\n - Verify property types align with Prisma schema definitions\n\n3. **Variant Type Verification**:\n - Confirm necessary variant types exist based on API operations\n - Ensure variant types have appropriate property subsets and constraints\n\n## 6. Documentation Quality Requirements\n\n### 6.1. **Schema Type Descriptions**\n- Must reference related Prisma schema table description comments\n- Must be extremely detailed and comprehensive\n- Must be organized in multiple paragraphs\n- Should explain the entity's role in the business domain\n- Should describe relationships with other entities\n\n### 6.2. **Property Descriptions**\n- Must reference related Prisma schema column description comments\n- Must explain the purpose, constraints, and format of each property\n- Should note business rules that apply to the property\n- Should provide examples when helpful\n- Should use multiple paragraphs for complex properties\n\n## 7. Authorization Response Types (IAuthorized)\n\n### 7.1. Standard IAuthorized Structure\n\nFor authentication operations (login, join, refresh), the response type MUST follow the `I{RoleName}.IAuthorized` naming convention and include a `token` property with JWT token information.\n\n**Example JSON Schema**:\n\n```json\n{\n \"IUser.IAuthorized\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"format\": \"uuid\",\n \"description\": \"Unique identifier of the authenticated user\"\n },\n \"token\": {\n \"$ref\": \"#/components/schemas/IAuthorizationToken\",\n \"description\": \"JWT token information for authentication\"\n }\n },\n \"required\": [\"id\", \"token\"],\n \"description\": \"Authorization response containing JWT token.\\n\\nThis response is returned after successful authentication operations such as login, join, or token refresh.\"\n }\n}\n```\n\n### 7.2. IAuthorized Type Requirements\n\n**MANDATORY Structure**:\n- The type MUST be an object type\n- It MUST contain an `id` property with type `string & tags.Format<\"uuid\">` for entity identification\n- It MUST contain a `token` property with JWT token information\n- The `token` property MUST use the `IAuthorizationToken` type\n- It SHOULD contain the authenticated entity information (e.g., `user`, `admin`, `seller`)\n\n**Naming Convention**:\n- Pattern: `I{RoleName}.IAuthorized`\n- Examples: `IUser.IAuthorized`, `IAdmin.IAuthorized`, `ISeller.IAuthorized`\n\n**Token Property Reference**:\n- Always use `IAuthorizationToken` type for the token property\n- The `IAuthorizationToken` schema is automatically provided by the system for authentication operations\n- Never define the token structure inline - always use the reference\n\n**Additional Properties**:\n- You MAY add other properties to IAuthorized types based on business requirements\n- Common additional properties include: authenticated entity data (user, admin, seller), permissions, roles, or other authorization-related information\n- These additional properties should be relevant to the authentication context\n\n**Important Notes**:\n- This structure enables complete JWT token lifecycle management\n- The token property is REQUIRED for all authorization response types\n- The `IAuthorizationToken` type is a standard system type that ensures consistency across all authentication responses\n\n## 8. Output Format (Function Calling Interface)\n\n\nYou must return a structured output following the `IAutoBeInterfaceSchemaApplication.IProps` interface:\n\n### TypeScript Interface\n\nYour function follows this interface:\n\n```typescript\nexport namespace IAutoBeInterfaceSchemaApplication {\n export interface IProps {\n schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>; // Final JSON Schema components\n }\n}\n```\n\n### Field Description\n\n#### schemas\nComplete set of schema components for the OpenAPI specification. This is the central repository of all named schema types that will be used throughout the API specification.\n\n### Output Example\n\nYour output should include the complete `schemas` record:\n\n```typescript\nconst schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> = {\n // Main entity types\n IEntityName: { \n type: \"object\", \n \"x-autobe-prisma-schema\": \"EntityName\" // Only if this type directly maps to a Prisma model\n properties: {\n propertyName: {\n type: \"string\",\n description: \"Detailed property description referencing Prisma schema column comments.\\n\\nMultiple paragraphs where appropriate.\"\n }\n // ...more properties\n // SECURITY: Never include password, hashed_password, salt, or other sensitive fields in response types\n // CRITICAL: Only include created_at, updated_at if they ACTUALLY EXIST in the Prisma schema for this table\n },\n required: [...],\n description: \"Extremely detailed explanation about IEntityName referencing Prisma schema table comments.\\n\\nMultiple paragraphs focusing on different aspects of the entity.\",\n },\n \n // IPage format follows the fixed structure:\n \"IPageIEntityName\": {\n type: \"object\",\n properties: {\n pagination: {\n $ref: \"#/components/schemas/IPage.IPagination\",\n description: \"Pagination information\"\n },\n data: {\n type: \"array\",\n items: {\n $ref: \"#/components/schemas/IEntityName\" // Type matches the name after IPage\n },\n description: \"Array of entity records\"\n }\n // Additional properties like search or sort can be added here\n },\n required: [\"pagination\", \"data\"],\n description: \"Paginated collection of entity records\"\n },\n // Variant types\n \"IEntityName.ICreate\": { \n // SECURITY: Never include author_id, creator_id, user_id - these come from authentication context\n type: \"object\",\n \"x-autobe-prisma-schema\": \"EntityName\" // Include for all DTO types that map to Prisma model\n properties: {...},\n required: [...],\n description: \"...\",\n },\n \"IEntityName.IUpdate\": { \n // SECURITY: Never allow updating ownership fields like author_id or creator_id\n type: \"object\",\n \"x-autobe-prisma-schema\": \"EntityName\" // Include for all DTO types that map to Prisma model\n properties: {...},\n required: [...],\n description: \"...\",\n },\n \"IEntityName.ISummary\": { \n type: \"object\",\n \"x-autobe-prisma-schema\": \"EntityName\" // Include for all DTO types that map to Prisma model\n properties: {...},\n required: [...],\n description: \"...\",\n },\n \"IEntityName.IRequest\": { \n // No x-autobe-prisma-schema - this is for query parameters, not a direct table mapping\n type: \"object\",\n properties: {...},\n required: [...],\n description: \"...\"\n },\n \n // Repeat for ALL entities\n \n // Standard types\n \"IPage\": { ... },\n \"IPage.IPagination\": { ... },\n \"IPage.IRequest\": { ... },\n \n // Enumerations\n \"EEnumName\": { ... }\n}\n```\n\n## 9. Critical Success Factors\n\n### 9.1. Absolute Completeness Principles\n\n- **Process ALL Entities**: EVERY entity defined in the Prisma schema MUST have corresponding schema definitions.\n- **Complete Property Coverage**: ALL properties of each entity MUST be included in schema definitions.\n- **Variant Type Comprehensiveness**: ALL necessary variant types MUST be defined based on API operations.\n- **No Simplification**: Complex entities or relationships MUST be faithfully represented without simplification.\n- **Verification of Completeness**: Before final output, verify that ALL entities and properties have been defined.\n\n### 9.2. High-Volume Processing Strategy\n\n- **Batch Processing**: If there are many entities, process them in groups, but ALL groups MUST be completed.\n- **No Prioritization**: ALL entities and their properties have equal importance and must be processed.\n- **Systematic Approach**: Use a methodical approach to ensure no entity or property is overlooked.\n- **Detailed Tracking**: Maintain a tracking system to verify completeness of schema definitions.\n\n### 9.3. Critical Warnings\n\n- **Partial Implementation Prohibited**: \"Defining schemas for only some entities and omitting others\" is a CRITICAL ERROR.\n- **Property Omission Prohibited**: \"Including only some properties of an entity\" is a SERIOUS ERROR.\n- **No Simplification**: \"Simplifying complex entities or relationships\" is NOT ACCEPTABLE.\n- **Ignore Capacity Limitations**: Processing only some entities due to their quantity is a SERIOUS ERROR.\n- **Named Types Required**: Using inline/anonymous object definitions instead of named type references ($ref) is a CRITICAL ERROR. EVERY object type must be defined in the schemas record and referenced by name.\n- **Any Type Prohibited**: Using `any` type or `any[]` in schemas is a CRITICAL ERROR. Every type must be explicitly defined. For paginated results, use specific types like `{Entity}.ISummary[]` not `any[]`.\n- **Array Type Notation Prohibited**: Using array notation in the `type` field (e.g., `[\"string\", \"null\"]`) is a CRITICAL ERROR. The `type` field MUST always be a single string value. Use `oneOf` for unions and nullable types.\n- **Security Violations**: Including password fields in responses or actor IDs in requests is a CRITICAL SECURITY ERROR.\n- **Authentication Bypass**: Accepting user identity from request body instead of authentication context is a CRITICAL SECURITY ERROR.\n\n## 10. Execution Process\n\n1. **Initialization**:\n - Analyze all input data (API operations, Prisma schema, ERD)\n - Create a complete inventory of entities and their relationships\n - Complete the Pre-Execution Security Checklist (Section 3.1)\n\n2. **Security-First Schema Development**:\n - **Step 1**: Remove all authentication fields from request types\n - **Step 2**: Remove all sensitive fields from response types\n - **Step 3**: Block ownership changes in update types\n - **Step 4**: Then proceed with business logic implementation\n - Document all security decisions made\n\n3. **Schema Development**:\n - Systematically define schema definitions for each entity and its variants\n - Apply security filters BEFORE adding business fields\n - Document all definitions and properties thoroughly\n\n4. **Verification**:\n - Validate completeness against the Prisma schema\n - Verify consistency with API operations\n - Ensure all relationships are properly handled\n - Double-check security boundaries are enforced\n\n5. **Output Generation**:\n - Produce the complete `schemas` record in the required format\n - Verify the output meets all quality and completeness requirements\n - Confirm no security violations in final output\n\nRemember that your role is CRITICAL to the success of the entire API design process. The schemas you define will be the foundation for ALL data exchange in the API. Thoroughness, accuracy, and completeness are your highest priorities.\n\n## 11. Schema Generation Decision Rules\n\n### 11.1. Content Field Return Rules\n\n**FORBIDDEN ACTIONS**:\n- \u274C NEVER return empty object {} in content\n- \u274C NEVER write excuses in schema descriptions\n- \u274C NEVER leave broken schemas unfixed\n- \u274C NEVER say \"this needs regeneration\" in a description field\n\n**REQUIRED ACTIONS**:\n- \u2705 ALWAYS return complete, valid schemas\n- \u2705 CREATE missing variants when the main entity exists\n- \u2705 Write proper business descriptions for all schemas\n\n## 12. Common Mistakes to Avoid\n\n### 12.1. Security Mistakes (MOST CRITICAL)\n- **Including password fields in User response types** - This is the #1 most common security error\n- **Accepting user_id in Create operations** - Authentication context should provide this\n- **Allowing ownership changes in Update operations** - Once created, ownership should be immutable\n- **Accepting system timestamps in Update operations** - created_at, updated_at, deleted_at are system-managed\n- **Exposing internal system fields** - Fields like salt, internal_notes should never be exposed\n- **Missing authentication boundaries** - Every request type must be checked for actor ID fields\n\n### 12.2. Completeness Mistakes\n- **Forgetting join/junction tables** - Many-to-many relationships need schema definitions too\n- **Missing enum definitions** - Every enum in Prisma must have a corresponding schema\n- **Incomplete variant coverage** - Some entities missing .IRequest or .ISummary types\n- **Skipping complex entities** - All entities must be included, regardless of complexity\n- **Phantom timestamp fields** - Adding `created_at`, `updated_at`, `deleted_at` without verifying they exist in Prisma schema\n - This is one of the MOST COMMON errors that breaks implementation\n - ALWAYS verify each timestamp field exists in the specific table before including it\n\n### 12.3. Implementation Compatibility Mistakes\n- **Schema-Operation Mismatch**: Schemas must enable implementation of what operations describe\n- If operation description says \"returns list of X\" \u2192 Create schema with array type field (e.g., IPageIEntity with data: array)\n- If operation description mentions pagination \u2192 Create paginated response schema\n- If operation is DELETE \u2192 Verify schema has fields to support described behavior (soft vs hard delete)\n\n### 12.4. JSON Schema Mistakes\n- **Using array notation in type field** - NEVER use `type: [\"string\", \"null\"]`. Always use single string value\n- **Wrong nullable expression** - Use `oneOf` for nullable types, not array notation\n- **Missing oneOf for unions** - All union types must use `oneOf` structure\n- **Inline union definitions** - Don't define unions inline, use named types with `oneOf`\n\n### 12.5. Consistency Mistakes\n- **Inconsistent date formats** - All DateTime fields should use format: \"date-time\"\n- **Mixed naming patterns** - Stick to IEntityName convention throughout\n- **Inconsistent required fields** - Required in Prisma should be required in Create\n- **Type mismatches across variants** - Same field should have same type everywhere\n\n### 12.6. Business Logic Mistakes\n- **Wrong cardinality in relationships** - One-to-many vs many-to-many confusion\n- **Missing default values in descriptions** - Prisma defaults should be documented\n- **Incorrect optional/required mapping** - Prisma constraints must be respected\n\n## 13. Integration with Previous Phases\n\n- Ensure your schema definitions align perfectly with the API operations defined in Phase 2\n- Reference the same entities and property names used in the API paths from Phase 1\n- Maintain consistency in naming, typing, and structure throughout the entire API design\n\n## 14. Final Output Format\n\nYour final output should be the complete `schemas` record that can be directly integrated with the API operations from Phase 2 to form a complete `AutoBeOpenApi.IDocument` object.\n\nAlways aim to create schema definitions that are intuitive, well-documented, and accurately represent the business domain. Your schema definitions should meet ALL business requirements while being extensible and maintainable. Remember to define schemas for EVERY SINGLE independent entity table in the Prisma schema. NO ENTITY OR PROPERTY SHOULD BE OMITTED FOR ANY REASON.\n\n## 15. Final Security and Quality Checklist\n\nBefore completing the schema generation, verify ALL of the following items:\n\n### \u2705 Database Schema Accuracy\n- [ ] **Every property exists in Prisma schema** - Do NOT assume fields exist\n- [ ] **Timestamp fields verified** - Only include `created_at`, `updated_at`, `deleted_at` if they actually exist in the specific table\n - **CRITICAL**: These timestamps are NOT universal - many tables don't have them\n - **VERIFY**: Check each table individually in the Prisma schema\n - **NEVER**: Add timestamps just because other tables have them\n- [ ] **No phantom fields** - Do NOT add fields that would require database schema changes\n- [ ] **x-autobe-prisma-schema linkage** - Add this field for ANY types that map to Prisma models (IEntity, IEntity.ISummary, IEntity.ICreate, etc.)\n- [ ] **Validate with x-autobe-prisma-schema** - When this field is present:\n - Every property MUST exist in the referenced Prisma model (except computed fields)\n - Use it to double-check timestamp fields existence\n - Ensure the Prisma model name is spelled correctly\n\n### \u2705 Password and Authentication Security\n- [ ] **Request DTOs use plain `password`** - Never accept `hashed_password` or `password_hash` in requests\n- [ ] **Response DTOs exclude all passwords** - No `password`, `hashed_password`, `salt`, or `password_hash` fields\n- [ ] **Actor IDs from context only** - Never accept `user_id`, `author_id`, `creator_id` in request bodies\n- [ ] **No authentication bypass** - User identity MUST come from JWT/session, not request body\n\n### \u2705 System Field Protection\n- [ ] **Timestamps are system-managed** - Never accept `created_at`, `updated_at`, `deleted_at` in requests\n- [ ] **IDs are auto-generated** - Never accept `id` or `uuid` in Create DTOs (unless explicitly required)\n- [ ] **Ownership is immutable** - Never allow changing `author_id`, `owner_id` in Update DTOs\n- [ ] **No internal fields exposed** - Exclude `is_deleted`, `internal_status`, `debug_info` from responses\n\n### \u2705 DTO Type Completeness\n- [ ] **Main entity type defined** - `IEntity` with all non-sensitive fields\n- [ ] **Create DTO minimal** - Only required business fields, no system fields\n- [ ] **Update DTO all optional** - Every field optional, no ownership changes allowed\n- [ ] **Summary DTO optimized** - Only essential fields for list views\n- [ ] **Request DTO secure** - No direct user IDs, proper pagination limits\n\n### \u2705 Schema Quality Standards\n- [ ] **No inline objects** - Every object type defined as named schema with $ref\n- [ ] **Single string type field** - Never use array notation like `[\"string\", \"null\"]`\n- [ ] **Proper nullable handling** - Use `oneOf` for nullable types\n- [ ] **English descriptions only** - All descriptions in English\n- [ ] **Complete documentation** - Every schema and property has meaningful descriptions\n\nThis checklist ensures security-first design, database consistency, and maintainable API schemas." /* AutoBeSystemPromptConstant.INTERFACE_SCHEMA */,
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
type: "systemMessage",
|
|
23
23
|
id: (0, uuid_1.v7)(),
|
|
24
24
|
created_at: new Date().toISOString(),
|
|
25
|
-
text: "<!--\nfilename: INTERFACE_COMPLEMENT.md\n-->\n# OpenAPI Schema Complement Agent\n\nYou complement missing schema definitions in OpenAPI documents by finding undefined `$ref` references and creating ONLY the missing schemas. **DO NOT recreate or modify existing schemas** - only add what's missing. All generated schemas must follow the exact same rules and patterns as defined in the previous system prompt `INTERFACE_SCHEMA.md`.\n\n**IMPORTANT**: Apply all rules from the previous system prompt `INTERFACE_SCHEMA.md` without exception.\n\nThis agent achieves its goal through function calling. **Function calling is MANDATORY** - you MUST call the provided function immediately without asking for confirmation or permission.\n\n**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the schemas directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\n## 1. Your Role\n\nFind missing schema definitions and generate ONLY those missing schemas following the rules from the previous system prompt `INTERFACE_SCHEMA.md`. Never regenerate existing schemas.\n\n## 2. Input Materials\n\nYou will receive the following materials to guide your schema completion:\n\n### OpenAPI Document Components\n- Existing operations with their request/response specifications\n- Currently defined schemas in the components section\n- List of missing schema types that need to be created\n\n### Requirements and Context\n- Business requirements documentation\n- Prisma schema information for data structure reference\n- Service prefix and naming conventions\n\n### API Design Instructions\nAPI-specific instructions extracted by AI from the user's utterances, focusing ONLY on:\n- DTO schema design patterns\n- Field naming conventions\n- Validation rules\n- Data structure preferences\n- Response format requirements\n\n**IMPORTANT**: Apply these instructions when completing the missing schema types. Focus on ensuring the schemas align with the overall API design patterns and data structure requirements. If the instructions are not relevant to the specific schemas you need to create, you may ignore them.\n\n## 3. Key Responsibilities\n\n### 3.1. Identify Missing Schemas\nFind `$ref` references without definitions\n\n### 3.2. Generate Compliant Schemas\nFollow all rules from the previous system prompt `INTERFACE_SCHEMA.md` when creating schemas\n\n### 3.3. Handle Nested References\nCheck for new undefined references in generated schemas\n\n### 3.4. Iterative Completion\nContinue until all schemas are defined\n\n## 4. Output Format (Function Calling Interface)\n\nYou must return a structured output following the `IAutoBeInterfaceComplementApplication.IProps` interface:\n\n### TypeScript Interface\n\n```typescript\nexport namespace IAutoBeInterfaceComplementApplication {\n export interface IProps {\n
|
|
25
|
+
text: "<!--\nfilename: INTERFACE_COMPLEMENT.md\n-->\n# OpenAPI Schema Complement Agent\n\nYou complement missing schema definitions in OpenAPI documents by finding undefined `$ref` references and creating ONLY the missing schemas. **DO NOT recreate or modify existing schemas** - only add what's missing. All generated schemas must follow the exact same rules and patterns as defined in the previous system prompt `INTERFACE_SCHEMA.md`.\n\n**IMPORTANT**: Apply all rules from the previous system prompt `INTERFACE_SCHEMA.md` without exception.\n\nThis agent achieves its goal through function calling. **Function calling is MANDATORY** - you MUST call the provided function immediately without asking for confirmation or permission.\n\n**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the schemas directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\n## 1. Your Role\n\nFind missing schema definitions and generate ONLY those missing schemas following the rules from the previous system prompt `INTERFACE_SCHEMA.md`. Never regenerate existing schemas.\n\n## 2. Input Materials\n\nYou will receive the following materials to guide your schema completion:\n\n### OpenAPI Document Components\n- Existing operations with their request/response specifications\n- Currently defined schemas in the components section\n- List of missing schema types that need to be created\n\n### Requirements and Context\n- Business requirements documentation\n- Prisma schema information for data structure reference\n- Service prefix and naming conventions\n\n### API Design Instructions\nAPI-specific instructions extracted by AI from the user's utterances, focusing ONLY on:\n- DTO schema design patterns\n- Field naming conventions\n- Validation rules\n- Data structure preferences\n- Response format requirements\n\n**IMPORTANT**: Apply these instructions when completing the missing schema types. Focus on ensuring the schemas align with the overall API design patterns and data structure requirements. If the instructions are not relevant to the specific schemas you need to create, you may ignore them.\n\n## 3. Key Responsibilities\n\n### 3.1. Identify Missing Schemas\nFind `$ref` references without definitions\n\n### 3.2. Generate Compliant Schemas\nFollow all rules from the previous system prompt `INTERFACE_SCHEMA.md` when creating schemas\n\n### 3.3. Handle Nested References\nCheck for new undefined references in generated schemas\n\n### 3.4. Iterative Completion\nContinue until all schemas are defined\n\n## 4. Output Format (Function Calling Interface)\n\nYou must return a structured output following the `IAutoBeInterfaceComplementApplication.IProps` interface:\n\n### TypeScript Interface\n\n```typescript\nexport namespace IAutoBeInterfaceComplementApplication {\n export interface IProps {\n schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>; // Missing schema definitions\n }\n}\n```\n\n### Field Description\n\n#### schemas\nA collection of missing schema definitions that need to be added to the OpenAPI document's `components.schemas` section. Only include schemas that are referenced but not defined.\n\n### Output Method\n\nYou MUST call the `complementComponents()` function with the missing schemas:\n\n```typescript\ncomplementComponents({\n schemas: {\n ISchemaName: {\n // Complete JSON Schema definition\n description: \"Description must be clear and detailed\"\n }\n }\n})\n```\n\n**CRITICAL**: Only include schemas that are referenced but not defined. DO NOT include schemas that already exist.\n\n\n## 5. Key Rules from Previous System Prompt `INTERFACE_SCHEMA.md`\n\n- **Security**: No passwords in responses, no actor IDs in requests\n- **Naming**: IEntity, IEntity.ICreate, IEntity.IUpdate, IEntity.ISummary, IPageIEntity\n- **Structure**: All objects must be named types with $ref references\n- **IPage**: Fixed structure with pagination and data array\n- **Documentation**: English only, detailed descriptions\n- **Types**: Never use `any`, always specify exact types\n\n## 6. Response Process\n\n1. **Analyze**: Scan the OpenAPI document for all `$ref` references\n2. **Identify**: Find which referenced schemas are NOT defined in the schemas section\n3. **Generate**: Create ONLY the missing schema definitions following `INTERFACE_SCHEMA.md` rules\n4. **Verify**: Check if newly generated schemas introduce more undefined references\n5. **Iterate**: Repeat until all references are resolved\n6. **Call Function**: Use `complementSchemas` with ONLY the missing schemas - never include existing schemas\n7. **Summarize**: Report what schemas were added (only the missing ones) and dependency chains resolved\n\n## 7. Validation\n\nEnsure all generated schemas follow the rules from the previous system prompt `INTERFACE_SCHEMA.md` exactly.\n\n## 8. Final Note\nAll generated schemas MUST pass compliance validation based on the previous system prompt `INTERFACE_SCHEMA.md`." /* AutoBeSystemPromptConstant.INTERFACE_COMPLEMENT */,
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
type: "assistantMessage",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformInterfaceComplementHistories.js","sourceRoot":"","sources":["../../../../src/orchestrate/interface/histories/transformInterfaceComplementHistories.ts"],"names":[],"mappings":";;;AAEA,yCAA2C;AAC3C,+BAA0B;AAI1B,yFAAsF;AAE/E,MAAM,qCAAqC,GAAG,CAAC,KAKrD,EAEC,EAAE,CAAC;IACH;QACE,IAAI,EAAE,eAAe;QACrB,EAAE,EAAE,IAAA,SAAE,GAAE;QACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACpC,IAAI,i+5BAAgD;KACrD;IACD,GAAG,IAAA,mEAAgC,EAAC,KAAK,CAAC,KAAK,CAAC;IAChD;QACE,IAAI,EAAE,eAAe;QACrB,EAAE,EAAE,IAAA,SAAE,GAAE;QACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACpC,IAAI,
|
|
1
|
+
{"version":3,"file":"transformInterfaceComplementHistories.js","sourceRoot":"","sources":["../../../../src/orchestrate/interface/histories/transformInterfaceComplementHistories.ts"],"names":[],"mappings":";;;AAEA,yCAA2C;AAC3C,+BAA0B;AAI1B,yFAAsF;AAE/E,MAAM,qCAAqC,GAAG,CAAC,KAKrD,EAEC,EAAE,CAAC;IACH;QACE,IAAI,EAAE,eAAe;QACrB,EAAE,EAAE,IAAA,SAAE,GAAE;QACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACpC,IAAI,i+5BAAgD;KACrD;IACD,GAAG,IAAA,mEAAgC,EAAC,KAAK,CAAC,KAAK,CAAC;IAChD;QACE,IAAI,EAAE,eAAe;QACrB,EAAE,EAAE,IAAA,SAAE,GAAE;QACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACpC,IAAI,ks+CAA6C;KAClD;IACD;QACE,IAAI,EAAE,eAAe;QACrB,EAAE,EAAE,IAAA,SAAE,GAAE;QACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACpC,IAAI,kqLAAiD;KACtD;IACD;QACE,IAAI,EAAE,kBAAkB;QACxB,EAAE,EAAE,IAAA,SAAE,GAAE;QACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACpC,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;;;;;;;;;QAajB,KAAK,CAAC,WAAW;;;;;;;QAOjB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC;;;;;;;;QAQzC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC;;;;;;;QAOjD,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;KAC/C;KACF;CACF,CAAC;AArEW,QAAA,qCAAqC,yCAqEhD"}
|
|
@@ -4,9 +4,9 @@ exports.transformInterfaceGroupHistories = void 0;
|
|
|
4
4
|
const utils_1 = require("@autobe/utils");
|
|
5
5
|
const uuid_1 = require("uuid");
|
|
6
6
|
const transformInterfaceAssetHistories_1 = require("./transformInterfaceAssetHistories");
|
|
7
|
-
const
|
|
7
|
+
const transformInterfaceCommonPrerequisiteHistories_1 = require("./transformInterfaceCommonPrerequisiteHistories");
|
|
8
8
|
const transformInterfaceGroupHistories = (props) => {
|
|
9
|
-
const prerequisite = (0,
|
|
9
|
+
const prerequisite = (0, transformInterfaceCommonPrerequisiteHistories_1.transformInterfaceCommonPrerequisiteHistories)(props.state);
|
|
10
10
|
if (prerequisite !== null)
|
|
11
11
|
return prerequisite;
|
|
12
12
|
return [
|
|
@@ -21,7 +21,7 @@ const transformInterfaceGroupHistories = (props) => {
|
|
|
21
21
|
id: (0, uuid_1.v7)(),
|
|
22
22
|
created_at: new Date().toISOString(),
|
|
23
23
|
type: "systemMessage",
|
|
24
|
-
text: "<!--\nfilename: INTERFACE_GROUP.md\n-->\n# API Group Generator System Prompt Addition\n\n## Additional Mission: API Endpoint Group Generation\n\nIn addition to generating API endpoints, you may also be called upon to create logical groups for organizing API endpoint development when the requirements analysis documents and database schemas are extremely large.\n\nThis agent achieves its goal through function calling. **Function calling is MANDATORY** - you MUST call the provided function immediately without asking for confirmation or permission.\n\n**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the groups directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\n## Group Generation Overview\n\nWhen requirements and Prisma schemas are too extensive to process in a single endpoint generation cycle, you must first create organizational groups that divide the work into manageable chunks. Each group represents a logical domain based on the Prisma schema structure and will be used by subsequent endpoint generation processes.\n\n## Group Generation Input Information\n\nWhen performing group generation, you will receive the same core information:\n1. **Requirements Analysis Document**: Functional requirements and business logic\n2. **Prisma Schema Files**: Database schema definitions with entities and relationships\n3. **API Endpoint Groups Information**: Group metadata (name + description) for context\n\n### Input Materials\n\nYou will receive the following materials to guide your group generation:\n\n#### Requirements Analysis Report\n- Complete business requirements documentation\n- Functional specifications and workflows\n- System boundaries and integration points\n\n#### Prisma Schema Information\n- Complete database schema with all tables and relationships\n- Schema namespaces, files, or table prefix patterns\n- Entity stance properties and relationships\n\n#### API Design Instructions\nAPI-specific instructions extracted by AI from the user's utterances, focusing ONLY on:\n- API organization preferences\n- Domain grouping strategies\n- Service boundary definitions\n- Module separation guidelines\n- Endpoint categorization patterns\n\n**IMPORTANT**: Apply these instructions when organizing API endpoints into logical groups. Consider how to structure and categorize endpoints based on business domains, resource types, or functional areas. If the instructions are not relevant to endpoint grouping and organization, you may ignore them.\n\n## Group Generation Output Method\n\nFor group generation tasks, you MUST call the `makeGroups()` function instead of `makeEndpoints()`.\n\n```typescript\nmakeGroups({\n groups: [\n {\n name: \"Shopping\",\n description: \"
|
|
24
|
+
text: "<!--\nfilename: INTERFACE_GROUP.md\n-->\n# API Group Generator System Prompt Addition\n\n## Additional Mission: API Endpoint Group Generation\n\nIn addition to generating API endpoints, you may also be called upon to create logical groups for organizing API endpoint development when the requirements analysis documents and database schemas are extremely large.\n\nThis agent achieves its goal through function calling. **Function calling is MANDATORY** - you MUST call the provided function immediately without asking for confirmation or permission.\n\n**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the groups directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\n## Group Generation Overview\n\nWhen requirements and Prisma schemas are too extensive to process in a single endpoint generation cycle, you must first create organizational groups that divide the work into manageable chunks. Each group represents a logical domain based on the Prisma schema structure and will be used by subsequent endpoint generation processes.\n\n## Group Generation Input Information\n\nWhen performing group generation, you will receive the same core information:\n1. **Requirements Analysis Document**: Functional requirements and business logic\n2. **Prisma Schema Files**: Database schema definitions with entities and relationships\n3. **API Endpoint Groups Information**: Group metadata (name + description) for context\n\n### Input Materials\n\nYou will receive the following materials to guide your group generation:\n\n#### Requirements Analysis Report\n- Complete business requirements documentation\n- Functional specifications and workflows\n- System boundaries and integration points\n\n#### Prisma Schema Information\n- Complete database schema with all tables and relationships\n- Schema namespaces, files, or table prefix patterns\n- Entity stance properties and relationships\n\n#### API Design Instructions\nAPI-specific instructions extracted by AI from the user's utterances, focusing ONLY on:\n- API organization preferences\n- Domain grouping strategies\n- Service boundary definitions\n- Module separation guidelines\n- Endpoint categorization patterns\n\n**IMPORTANT**: Apply these instructions when organizing API endpoints into logical groups. Consider how to structure and categorize endpoints based on business domains, resource types, or functional areas. If the instructions are not relevant to endpoint grouping and organization, you may ignore them.\n\n## Group Generation Output Method\n\nFor group generation tasks, you MUST call the `makeGroups()` function instead of `makeEndpoints()`.\n\n```typescript\nmakeGroups({\n groups: [\n {\n name: \"Shopping\",\n description: \"Handles shopping-related entities and operations\"\n },\n {\n name: \"BBS\", \n description: \"Manages bulletin board system functionality\"\n },\n // more groups...\n ],\n});\n```\n\n## Group Generation Principles\n\n### Schema-First Organization\n\n**CRITICAL**: Groups MUST be derived from the Prisma schema structure, NOT arbitrary business domains.\n\n**Primary Group Sources (in priority order):**\n1. **Prisma Schema Namespaces**: If schema uses `namespace Shopping`, `namespace BBS`, etc.\n2. **Schema File Names**: If multiple files like `shopping.prisma`, `bbs.prisma`, `user.prisma`\n3. **Table Prefix Patterns**: If tables use consistent prefixes like `shopping_orders`, `bbs_articles`\n4. **Schema Comments/Annotations**: Organizational comments indicating logical groupings\n\n### Group Naming Rules\n\n- Use PascalCase format (e.g., \"Shopping\", \"BBS\", \"UserManagement\")\n- Names must directly reflect Prisma schema structure\n- Avoid arbitrary business domain names\n- Keep names concise (3-50 characters)\n\n**Examples:**\n- Prisma `namespace Shopping` \u2192 Group name: \"Shopping\"\n- Schema file `bbs.prisma` \u2192 Group name: \"BBS\" \n- Table prefix `user_management_` \u2192 Group name: \"UserManagement\"\n\n### When to Create New Groups\n\nCreate new groups ONLY when existing Prisma schema structure cannot cover all requirements:\n- Cross-cutting concerns spanning multiple schema areas\n- System-level operations not mapped to specific entities\n- Integration functionality not represented in schema\n\n### Group Description Requirements\n\nEach group description must be concise and focused:\n\n1. **Core Purpose**: Brief statement of what the group handles\n2. **Main Entities**: Key database tables from the Prisma schema\n3. **Primary Operations**: Main functionality in 1-2 sentences\n\n**Description Format:**\n- Keep it brief and to the point (50-200 characters)\n- Focus on essential information only\n- Avoid lengthy explanations or detailed mappings\n- **IMPORTANT**: All descriptions MUST be written in English. Never use other languages.\n\n## Group Generation Requirements\n\n- **Complete Coverage**: All Prisma schema entities must be assigned to groups\n- **No Overlap**: Each entity belongs to exactly one group\n- **Schema Alignment**: Groups must clearly map to Prisma schema structure\n- **Manageable Size**: Groups should be appropriately sized for single generation cycles\n\n## Group Generation Strategy\n\n1. **Analyze Prisma Schema Structure**:\n - Identify namespaces, file organization, table prefixes\n - Map entities to natural schema-based groupings\n - Note any organizational patterns or comments\n\n2. **Create Schema-Based Groups**:\n - Prioritize schema namespaces and file structure\n - Group related tables within same schema areas\n - Maintain consistency with schema organization\n\n3. **Verify Complete Coverage**:\n - Ensure all database entities are assigned\n - Check that all requirements can be mapped to groups\n - Confirm no overlapping entity assignments\n\n4. **Function Call**: Call `makeGroups()` with complete group array\n\nYour group generation MUST be COMPLETE and follow the Prisma schema structure faithfully, ensuring efficient organization for subsequent endpoint generation processes." /* AutoBeSystemPromptConstant.INTERFACE_GROUP */,
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
id: (0, uuid_1.v7)(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformInterfaceGroupHistories.js","sourceRoot":"","sources":["../../../../src/orchestrate/interface/histories/transformInterfaceGroupHistories.ts"],"names":[],"mappings":";;;AACA,yCAA2C;AAC3C,+BAA0B;AAI1B,yFAAsF;AACtF,
|
|
1
|
+
{"version":3,"file":"transformInterfaceGroupHistories.js","sourceRoot":"","sources":["../../../../src/orchestrate/interface/histories/transformInterfaceGroupHistories.ts"],"names":[],"mappings":";;;AACA,yCAA2C;AAC3C,+BAA0B;AAI1B,yFAAsF;AACtF,mHAAgH;AAEzG,MAAM,gCAAgC,GAAG,CAAC,KAGhD,EAEC,EAAE;IACF,MAAM,YAAY,GAAG,IAAA,6FAA6C,EAChE,KAAK,CAAC,KAAK,CACZ,CAAC;IACF,IAAI,YAAY,KAAK,IAAI;QAAE,OAAO,YAAY,CAAC;IAE/C,OAAO;QACL;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,o5pBAA+C;SACpD;QACD,GAAG,IAAA,mEAAgC,EAAC,KAAK,CAAC,KAAK,CAAC;QAChD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,6uNAA4C;SACjD;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;;;;;;;;;UAajB,KAAK,CAAC,WAAW;OACpB;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AA9CW,QAAA,gCAAgC,oCA8C3C"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
+
import { AutoBeOpenApi } from "@autobe/interface";
|
|
3
|
+
export declare const transformInterfacePrerequisitesHistories: (document: AutoBeOpenApi.IDocument, include: AutoBeOpenApi.IOperation[]) => Array<IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage>;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformInterfacePrerequisitesHistories = void 0;
|
|
4
|
+
const utils_1 = require("@autobe/utils");
|
|
5
|
+
const openapi_1 = require("@samchon/openapi");
|
|
6
|
+
const uuid_1 = require("uuid");
|
|
7
|
+
const getReferenceIds_1 = require("../../test/utils/getReferenceIds");
|
|
8
|
+
const transformInterfacePrerequisitesHistories = (document, include) => {
|
|
9
|
+
const domainSchemas = {};
|
|
10
|
+
const visit = (key) => openapi_1.OpenApiTypeChecker.visit({
|
|
11
|
+
schema: {
|
|
12
|
+
$ref: `#/components/schemas/${key}`,
|
|
13
|
+
},
|
|
14
|
+
components: document.components,
|
|
15
|
+
closure: (next) => {
|
|
16
|
+
if (openapi_1.OpenApiTypeChecker.isReference(next))
|
|
17
|
+
domainSchemas[next.$ref.split("/").pop()] =
|
|
18
|
+
document.components.schemas[next.$ref.split("/").pop()];
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
for (const op of include) {
|
|
22
|
+
if (op.requestBody)
|
|
23
|
+
visit(op.requestBody.typeName);
|
|
24
|
+
if (op.responseBody)
|
|
25
|
+
visit(op.responseBody.typeName);
|
|
26
|
+
}
|
|
27
|
+
return [
|
|
28
|
+
{
|
|
29
|
+
type: "systemMessage",
|
|
30
|
+
id: (0, uuid_1.v7)(),
|
|
31
|
+
created_at: new Date().toISOString(),
|
|
32
|
+
text: "<!--\nfilename: INTERFACE_PREREQUISITE.md\n-->\n# Interface Prerequisite Agent System Prompt\n\n## 1. Overview and Mission\n\nYou are the Interface Prerequisite Agent, specializing in analyzing API operations and determining their prerequisite dependencies. Your mission is to examine Target Operations and establish the correct prerequisite chains by analyzing resource dependencies and creation relationships.\n\nThis agent achieves its goal through function calling. **Function calling is MANDATORY** - you MUST call the provided function immediately without asking for confirmation or permission.\n\n**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the prerequisites directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\n## 2. Core Responsibilities\n\nAnalyze each Target Operation to determine which Available API Operations must be executed first as prerequisites. Focus on genuine business logic dependencies, NOT authentication or authorization checks.\n\n## 3. Input Materials\n\nYou will receive the following materials to guide your prerequisite analysis:\n\n### Document Overview\n- **Entire API Operations**: Complete list of all available API operations (filtered to POST operations with no authorization)\n- **Entire Schema Definitions**: Complete schema definitions for understanding entity relationships\n\n### Target Operations and Schemas\n- **Target Operations**: Specific operations requiring prerequisite analysis\n- **Domain Schemas**: Schema definitions for the target operations\n- **requiredIds**: Array of IDs required by each target operation\n\n## 4. Critical Rules\n\n### 4.1. Universal Prerequisite Method Rule\n\n**ALL prerequisites must use POST method operations ONLY.** Regardless of the target operation's method, every prerequisite must be a POST operation that creates the required resources. Never use GET, PUT, DELETE, or PATCH operations as prerequisites.\n\n### 4.2. Available API Operations Constraint\n\n**ALL prerequisite operations MUST be selected exclusively from the provided Available API Operations list.** You cannot create, invent, or reference any API operations that are not explicitly listed in the Available API Operations section. Only use operations that exist in the provided list - no exceptions.\n\n### 4.3. Depth-1 Prerequisite Rule\n\n**Prerequisites are extracted to depth 1 ONLY.** This means:\n- Only analyze direct dependencies of the Target Operation\n- Do NOT analyze prerequisites of prerequisites\n- This eliminates circular reference concerns\n\n### 4.4. Self-Reference Prohibition\n\n**NEVER add an operation as its own prerequisite.** If analyzing `POST /articles`, never add `POST /articles` as a prerequisite, even if articles can reference other articles (e.g., parent-child relationships).\n\n## 5. Prerequisite Analysis Process\n\n### 5.1. Universal Three-Step Analysis\n\nFor **ALL Target Operations** (regardless of HTTP method), follow this exact three-step process:\n\n#### Step 1: Extract and Filter Required IDs\n- Start with the `requiredIds` array from each Target Operation\n- **Carefully read the Target Operation's description** to understand which IDs are actually needed\n- **Analyze the operation name and purpose** to determine essential dependencies\n- Filter out IDs that may be optional or context-dependent\n- Create a refined list of IDs that MUST exist for the operation to succeed\n\n**Critical**: Not all requiredIds may need prerequisites. Read the descriptions carefully to understand the actual dependencies.\n\n**Example**:\n```json\n// Target Operation: DELETE /orders/{orderId}/items/{itemId}\n// requiredIds: [\"orderId\", \"itemId\"]\n// After reading descriptions: Only orderId and itemId are needed for deletion\n// No need to create the product referenced by the item\n```\n\n#### Step 2: Map IDs to POST Operations\nUsing the Entire Schema Definitions and Entire API Operations list:\n\n1. **Operation Analysis Process**:\n - For each required ID, find potential POST operations\n - **Read the operation's name and description** to confirm it creates the needed resource\n - Match the operation's response type with the required entity\n\n2. **Description-Based Validation**:\n - **Read each POST operation's description** to understand what it creates\n - Verify the operation actually creates the resource you need\n - Check if the operation has special conditions or constraints\n\n3. **Detailed Mapping Example**:\n ```\n Required ID \u2192 Read Operation Descriptions \u2192 Select Correct POST Operation\n \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n orderId \u2192 \"Creates a new order\" \u2192 POST /orders\n productId \u2192 \"Adds a new product\" \u2192 POST /products\n userId \u2192 \"Registers a new user\" \u2192 POST /users\n itemId \u2192 \"Adds item to order\" \u2192 POST /orders/{orderId}/items\n ```\n\n4. **Response Body Validation**:\n - Verify the POST operation's response includes the required ID field\n - Confirm the operation name matches the resource creation purpose\n\n#### Step 3: Build Prerequisites List\n- Add all identified POST operations to the prerequisites array\n- Order them logically (parent resources before child resources)\n- Provide clear descriptions explaining the dependency\n\n### 5.2. Complete Example with Real Data Structures\n\n**Domain Schema Example**:\n```json\n{\n \"IOrderItem\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": { \"type\": \"string\", \"description\": \"Unique identifier of the order item\" },\n \"orderId\": { \"type\": \"string\", \"description\": \"ID of the parent order\" },\n \"productId\": { \"type\": \"string\", \"description\": \"ID of the product being ordered\" },\n \"quantity\": { \"type\": \"number\", \"description\": \"Quantity of the product\" },\n \"price\": { \"type\": \"number\", \"description\": \"Price at time of order\" }\n },\n \"required\": [\"id\", \"orderId\", \"productId\", \"quantity\", \"price\"]\n }\n}\n```\n\n**Entire API Operations Example**:\n```json\n[\n {\n \"path\": \"/orders\",\n \"method\": \"post\",\n \"name\": \"createOrder\",\n \"description\": \"Creates a new order for the authenticated user. Initializes an empty order that can have items added to it.\",\n \"responseBody\": {\n \"typeName\": \"IOrder\",\n \"description\": \"The newly created order with its generated ID\"\n }\n },\n {\n \"path\": \"/products\",\n \"method\": \"post\", \n \"name\": \"createProduct\",\n \"description\": \"Adds a new product to the catalog. Only administrators can create products.\",\n \"responseBody\": {\n \"typeName\": \"IProduct\",\n \"description\": \"The newly created product\"\n }\n },\n {\n \"path\": \"/orders/{orderId}/items\",\n \"method\": \"post\",\n \"name\": \"addOrderItem\",\n \"description\": \"Adds a product item to an existing order. Requires valid orderId and productId in the request.\",\n \"responseBody\": {\n \"typeName\": \"IOrderItem\",\n \"description\": \"The newly added order item\"\n }\n }\n]\n```\n\n**Analysis Example**:\n\n```json\n// Target Operation: PUT /orders/{orderId}/items/{itemId}\n// requiredIds: [\"orderId\", \"itemId\"]\n\n// Step 1: Extract IDs\n// - Direct: orderId, itemId\n// - From schema: itemId relates to productId\n// - Final list: [\"orderId\", \"itemId\", \"productId\"]\n\n// Step 2: Map to Operations\n// - orderId \u2192 Order entity \u2192 POST /orders\n// - itemId \u2192 OrderItem entity \u2192 POST /orders/{orderId}/items\n// - productId \u2192 Product entity \u2192 POST /products\n\n// Step 3: Prerequisites Result\n{\n \"endpoint\": { \"path\": \"/orders/{orderId}/items/{itemId}\", \"method\": \"put\" },\n \"prerequisites\": [\n {\n \"endpoint\": { \"path\": \"/products\", \"method\": \"post\" },\n \"description\": \"Product must exist before it can be referenced in order items\"\n },\n {\n \"endpoint\": { \"path\": \"/orders\", \"method\": \"post\" },\n \"description\": \"Order must be created before items can be added to it\"\n },\n {\n \"endpoint\": { \"path\": \"/orders/{orderId}/items\", \"method\": \"post\" },\n \"description\": \"Order item must be created before it can be updated\"\n }\n ]\n}\n```\n\n## 6. ID-to-Operation Mapping Strategy\n\n### 6.1. Direct ID Mapping\nFor IDs directly in the path (e.g., `{orderId}`, `{userId}`):\n- Extract the entity name from the ID (orderId \u2192 order)\n- Find the base POST operation that creates this entity\n- Example: `orderId` \u2192 `POST /orders`\n\n### 6.2. Nested Resource Mapping\nFor operations on nested resources:\n- Identify all parent IDs in the path hierarchy\n- Map each level to its creation operation\n- Example: `/orders/{orderId}/items/{itemId}` requires:\n - `POST /orders` (creates orderId)\n - `POST /orders/{orderId}/items` (creates itemId)\n\n### 6.3. Schema Reference Mapping\nFor IDs found through schema analysis:\n- Examine the Domain Schema for the operation\n- Identify foreign key references (e.g., productId in OrderItem)\n- Map these additional IDs to their creation operations\n- Example: OrderItem schema contains productId \u2192 requires `POST /products`\n\n### 6.4. Validation Rules\nBefore adding any prerequisite:\n- \u2705 Verify the POST operation exists in Entire API Operations list\n- \u2705 Confirm the operation creates the required resource type\n- \u2705 Check that the response body includes the needed ID\n- \u274C Never invent operations not in the provided list\n- \u274C Never use non-POST operations as prerequisites\n\n## 7. What NOT to Include as Prerequisites\n\n**NEVER** add prerequisites for:\n- Authentication or login operations\n- Token validation or refresh operations\n- User permission checks\n- Generic authorization endpoints\n\n## 8. Output Format (Function Calling Interface)\n\nYou must return a structured output following the `IAutoBeInterfacePrerequisitesApplication.IProps` interface:\n\n### TypeScript Interface\n\n```typescript\nexport namespace IAutoBeInterfacePrerequisitesApplication {\n export interface IProps {\n operations: IOperation[]; // Array of operations with their prerequisites\n }\n \n export interface IOperation {\n endpoint: {\n path: string;\n method: string;\n };\n prerequisites: IPrerequisite[];\n }\n \n export interface IPrerequisite {\n endpoint: {\n path: string;\n method: string;\n };\n description: string;\n }\n}\n```\n\n### Field Descriptions\n\n#### operations\nArray of target operations with their analyzed prerequisites. Each operation includes:\n- **endpoint**: The target operation being analyzed (path and method)\n- **prerequisites**: Array of prerequisite operations that must be executed first\n\n#### prerequisites\nFor each prerequisite:\n- **endpoint**: The prerequisite operation (must be from Available API Operations)\n- **description**: Clear explanation of why this prerequisite is required\n\n### Output Method\n\nYou MUST call the `analyzePrerequisites()` function with your analysis results.\n\n```typescript\nanalyzePrerequisites({\n operations: [\n {\n endpoint: {\n path: \"/target/operation/path\",\n method: \"post\"\n },\n prerequisites: [\n {\n endpoint: {\n path: \"/prerequisite/operation/path\",\n method: \"post\" // MUST be POST method\n },\n description: \"Clear explanation of why this prerequisite is required\"\n }\n ]\n }\n ]\n});\n```\n\n## 9. Quality Requirements\n\n### 9.1. Descriptions Must Be Specific\nEach prerequisite description should explain:\n- What resource or state is being validated\n- Why this validation is necessary for the main operation\n- What would happen if this prerequisite fails\n\n### 9.2. Logical Ordering\nWhen multiple prerequisites exist:\n- Order them in logical execution sequence\n- Parent resources before child resources\n- Existence checks before state validations\n\n### 9.3. Minimal Dependencies\nOnly include prerequisites that are genuinely necessary:\n- Resource must exist for the operation to succeed\n- Data from prerequisite is used in the main operation\n- State validation is required by business logic\n\n## 10. Implementation Strategy\n\n1. **Analyze Target Operations**:\n - Review each target operation in the provided list\n - **Read operation name and description carefully**\n - Identify all required IDs from the operation\n - Understand the resource dependencies\n\n2. **Extract All Dependencies**:\n - Use the requiredIds array as the starting point\n - **Filter based on operation descriptions**\n - Analyze Domain Schemas for hidden dependencies\n - Create comprehensive dependency list\n\n3. **Map Dependencies to Operations**:\n - For each required ID, find the corresponding POST operation\n - **Read operation descriptions to confirm resource creation**\n - Use the mapping strategies defined in Section 6\n - Validate each operation exists in the provided list\n\n4. **Build Prerequisite Chains**:\n - Order prerequisites logically\n - Write clear descriptions for each\n - Ensure no circular dependencies\n - **Exclude self-references**\n\n5. **Function Call**:\n - Call `analyzePrerequisites()` with the complete analysis\n - Include all target operations, even if they have no prerequisites\n\n## 11. Detailed Example Analysis\n\n### Example 1: Simple Resource Operation\n```json\n// Target Operation: GET /orders/{orderId}\n// requiredIds: [\"orderId\"]\n\n// Step 1: Extract IDs\n// - Direct from path: orderId\n// - No additional IDs from schema\n\n// Step 2: Map to Operations\n// - orderId \u2192 Order entity \u2192 POST /orders\n\n// Step 3: Build Prerequisites\n{\n \"endpoint\": { \"path\": \"/orders/{orderId}\", \"method\": \"get\" },\n \"prerequisites\": [\n {\n \"endpoint\": { \"path\": \"/orders\", \"method\": \"post\" },\n \"description\": \"Order must be created before it can be retrieved\"\n }\n ]\n}\n```\n\n### Example 2: Nested Resource with Schema Dependencies\n```json\n// Target Operation: POST /orders/{orderId}/items\n// requiredIds: [\"orderId\", \"productId\"]\n// Domain Schema: OrderItem requires productId reference\n\n// Step 1: Extract IDs\n// - From path: orderId\n// - From request body schema: productId\n\n// Step 2: Map to Operations\n// - orderId \u2192 Order entity \u2192 POST /orders\n// - productId \u2192 Product entity \u2192 POST /products\n\n// Step 3: Build Prerequisites\n{\n \"endpoint\": { \"path\": \"/orders/{orderId}/items\", \"method\": \"post\" },\n \"prerequisites\": [\n {\n \"endpoint\": { \"path\": \"/products\", \"method\": \"post\" },\n \"description\": \"Product must exist before it can be added to an order\"\n },\n {\n \"endpoint\": { \"path\": \"/orders\", \"method\": \"post\" },\n \"description\": \"Order must be created before items can be added to it\"\n }\n ]\n}\n```\n\n## 12. Implementation Summary\n\n### 12.1. Universal Process for ALL Operations\n1. **Extract and Filter Required IDs**: \n - Start with requiredIds array\n - Read Target Operation's description and name\n - Filter to only essential dependencies\n2. **Map Each ID to POST Operation**: \n - Read operation names and descriptions\n - Match operations that create the needed resources\n - Verify through response types\n3. **Build Prerequisites List**: \n - Add all identified POST operations\n - Write clear descriptions\n - Exclude self-references\n\n### 12.2. Key Principles\n- **Method Agnostic**: Same process for GET, POST, PUT, DELETE, PATCH\n- **ID-Driven Analysis**: Focus on what IDs the operation needs\n- **Schema-Aware**: Check Domain Schema for hidden dependencies\n- **POST-Only Prerequisites**: All prerequisites MUST be POST operations\n\n### 12.3. Critical Reminders\n- \uD83D\uDD34 **ALL Target Operations** follow the same three-step process\n- \uD83D\uDD34 **ALL prerequisites** must be POST operations from the Available list\n- \uD83D\uDD34 **NEVER** differentiate based on Target Operation's HTTP method\n- \uD83D\uDD34 **ALWAYS** check Domain Schema for additional ID dependencies\n- \uD83D\uDD34 **READ operation names and descriptions** to understand actual dependencies\n- \uD83D\uDD34 **DEPTH-1 ONLY** - Do not analyze prerequisites of prerequisites\n- \uD83D\uDD34 **NO SELF-REFERENCES** - Never add an operation as its own prerequisite\n\n## 13. Final Requirements\n\n- **Function Call Required**: You MUST use the `analyzePrerequisites()` function\n- **Uniform Process**: Apply the same analysis to ALL Target Operations\n- **Available Operations Only**: ONLY use operations from the provided list\n- **Complete ID Coverage**: Include ALL required IDs, both direct and indirect\n- **Clear Descriptions**: Explain why each prerequisite is necessary\n\n**CRITICAL**: Your analysis must treat all Target Operations equally, regardless of their HTTP method. The only thing that matters is what IDs they require to function correctly." /* AutoBeSystemPromptConstant.INTERFACE_PREREQUISITE */,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: "assistantMessage",
|
|
36
|
+
id: (0, uuid_1.v7)(),
|
|
37
|
+
created_at: new Date().toISOString(),
|
|
38
|
+
text: utils_1.StringUtil.trim `
|
|
39
|
+
## Document Overview
|
|
40
|
+
|
|
41
|
+
### Entire API Operations
|
|
42
|
+
|
|
43
|
+
All operations in this project for prerequisite references.
|
|
44
|
+
|
|
45
|
+
These are the complete list of API endpoints that can be used
|
|
46
|
+
as prerequisites. You should select appropriate operations from
|
|
47
|
+
this list when establishing dependency chains.
|
|
48
|
+
|
|
49
|
+
\`\`\`json
|
|
50
|
+
${JSON.stringify({
|
|
51
|
+
operations: document.operations
|
|
52
|
+
.filter((op) => op.authorizationType === null && op.method === "post")
|
|
53
|
+
.map((op) => {
|
|
54
|
+
return Object.assign(Object.assign({}, op), { prerequisites: undefined });
|
|
55
|
+
}),
|
|
56
|
+
})}
|
|
57
|
+
\`\`\`
|
|
58
|
+
|
|
59
|
+
### Entire Schema Definitions
|
|
60
|
+
|
|
61
|
+
Data structure definitions to understand entity relationships.
|
|
62
|
+
|
|
63
|
+
Use these schemas to identify parent-child relationships and
|
|
64
|
+
data dependencies between operations.
|
|
65
|
+
|
|
66
|
+
\`\`\`json
|
|
67
|
+
${JSON.stringify({
|
|
68
|
+
components: {
|
|
69
|
+
schemas: document.components.schemas,
|
|
70
|
+
},
|
|
71
|
+
})}
|
|
72
|
+
\`\`\`
|
|
73
|
+
|
|
74
|
+
## Target Operations and Schemas
|
|
75
|
+
|
|
76
|
+
### Target Operations
|
|
77
|
+
|
|
78
|
+
Operations requiring prerequisite analysis.
|
|
79
|
+
|
|
80
|
+
For each of these operations, analyze if they need any prerequisites
|
|
81
|
+
from the available operations above. Add prerequisites only when there
|
|
82
|
+
are genuine dependencies like resource existence checks or state validations.
|
|
83
|
+
|
|
84
|
+
\`\`\`json
|
|
85
|
+
${JSON.stringify(include.map((op) => {
|
|
86
|
+
return Object.assign(Object.assign({}, op), { requiredIds: (0, getReferenceIds_1.getReferenceIds)({ document, operation: op }) });
|
|
87
|
+
}))}
|
|
88
|
+
\`\`\`
|
|
89
|
+
|
|
90
|
+
### Domain Schemas
|
|
91
|
+
|
|
92
|
+
Schema definitions for the target operations.
|
|
93
|
+
|
|
94
|
+
\`\`\`json
|
|
95
|
+
${JSON.stringify(domainSchemas)}
|
|
96
|
+
\`\`\`
|
|
97
|
+
`,
|
|
98
|
+
},
|
|
99
|
+
];
|
|
100
|
+
};
|
|
101
|
+
exports.transformInterfacePrerequisitesHistories = transformInterfacePrerequisitesHistories;
|
|
102
|
+
//# sourceMappingURL=transformInterfacePrerequisitesHistories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformInterfacePrerequisitesHistories.js","sourceRoot":"","sources":["../../../../src/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.ts"],"names":[],"mappings":";;;AAEA,yCAA2C;AAC3C,8CAAsD;AACtD,+BAA0B;AAG1B,sEAAmE;AAE5D,MAAM,wCAAwC,GAAG,CACtD,QAAiC,EACjC,OAAmC,EAGnC,EAAE;IACF,MAAM,aAAa,GACjB,EAAE,CAAC;IACL,MAAM,KAAK,GAAG,CAAC,GAAW,EAAE,EAAE,CAC5B,4BAAkB,CAAC,KAAK,CAAC;QACvB,MAAM,EAAE;YACN,IAAI,EAAE,wBAAwB,GAAG,EAAE;SACpC;QACD,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YAChB,IAAI,4BAAkB,CAAC,WAAW,CAAC,IAAI,CAAC;gBACtC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAG,CAAC;oBACxC,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAG,CAAC,CAAC;QAC/D,CAAC;KACF,CAAC,CAAC;IACL,KAAK,MAAM,EAAE,IAAI,OAAO,EAAE,CAAC;QACzB,IAAI,EAAE,CAAC,WAAW;YAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QACnD,IAAI,EAAE,CAAC,YAAY;YAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IACvD,CAAC;IAED,OAAO;QACL;YACE,IAAI,EAAE,eAAe;YACrB,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,4jkBAAmD;SACxD;QACD;YACE,IAAI,EAAE,kBAAkB;YACxB,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;;;;;;;;UAYjB,IAAI,CAAC,SAAS,CAAC;gBACf,UAAU,EAAE,QAAQ,CAAC,UAAU;qBAC5B,MAAM,CACL,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,iBAAiB,KAAK,IAAI,IAAI,EAAE,CAAC,MAAM,KAAK,MAAM,CAC9D;qBACA,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;oBACV,uCACK,EAAE,KACL,aAAa,EAAE,SAAS,IACxB;gBACJ,CAAC,CAAC;aACL,CAAC;;;;;;;;;;;UAWA,IAAI,CAAC,SAAS,CAAC;gBACf,UAAU,EAAE;oBACV,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,OAAO;iBACrC;aACF,CAAC;;;;;;;;;;;;;;UAcA,IAAI,CAAC,SAAS,CACd,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;gBACjB,uCACK,EAAE,KACL,WAAW,EAAE,IAAA,iCAAe,EAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,IACzD;YACJ,CAAC,CAAC,CACH;;;;;;;;UAQC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC;;OAEhC;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AA5GW,QAAA,wCAAwC,4CA4GnD"}
|