@autobe/agent 0.30.2 → 0.30.3

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.
Files changed (81) hide show
  1. package/lib/AutoBeMockAgent.js +0 -2
  2. package/lib/AutoBeMockAgent.js.map +1 -1
  3. package/lib/constants/AutoBeConfigConstant.d.ts +1 -1
  4. package/lib/constants/AutoBeSystemPromptConstant.d.ts +12 -11
  5. package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
  6. package/lib/index.mjs +498 -55
  7. package/lib/index.mjs.map +1 -1
  8. package/lib/orchestrate/analyze/histories/transformAnalyzeExtractDecisionsHistory.d.ts +18 -0
  9. package/lib/orchestrate/analyze/histories/transformAnalyzeExtractDecisionsHistory.js +51 -0
  10. package/lib/orchestrate/analyze/histories/transformAnalyzeExtractDecisionsHistory.js.map +1 -0
  11. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistory.js +1 -1
  12. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistory.js.map +1 -1
  13. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioReviewHistory.js +1 -1
  14. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioReviewHistory.js.map +1 -1
  15. package/lib/orchestrate/analyze/histories/transformAnalyzeSectionCrossFileReviewHistory.d.ts +1 -0
  16. package/lib/orchestrate/analyze/histories/transformAnalyzeSectionCrossFileReviewHistory.js +15 -1
  17. package/lib/orchestrate/analyze/histories/transformAnalyzeSectionCrossFileReviewHistory.js.map +1 -1
  18. package/lib/orchestrate/analyze/histories/transformAnalyzeSectionReviewHistory.js +1 -1
  19. package/lib/orchestrate/analyze/histories/transformAnalyzeSectionReviewHistory.js.map +1 -1
  20. package/lib/orchestrate/analyze/orchestrateAnalyze.js +48 -13
  21. package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
  22. package/lib/orchestrate/analyze/orchestrateAnalyzeExtractDecisions.d.ts +17 -0
  23. package/lib/orchestrate/analyze/orchestrateAnalyzeExtractDecisions.js +345 -0
  24. package/lib/orchestrate/analyze/orchestrateAnalyzeExtractDecisions.js.map +1 -0
  25. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +2 -2
  26. package/lib/orchestrate/analyze/orchestrateAnalyzeSectionCrossFileReview.d.ts +1 -0
  27. package/lib/orchestrate/analyze/orchestrateAnalyzeSectionCrossFileReview.js +1 -0
  28. package/lib/orchestrate/analyze/orchestrateAnalyzeSectionCrossFileReview.js.map +1 -1
  29. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeExtractDecisionsApplication.d.ts +91 -0
  30. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeExtractDecisionsApplication.js +3 -0
  31. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeExtractDecisionsApplication.js.map +1 -0
  32. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.d.ts +15 -5
  33. package/lib/orchestrate/analyze/utils/buildErrorCodeRegistry.d.ts +0 -9
  34. package/lib/orchestrate/analyze/utils/buildErrorCodeRegistry.js +1 -13
  35. package/lib/orchestrate/analyze/utils/buildErrorCodeRegistry.js.map +1 -1
  36. package/lib/orchestrate/analyze/utils/detectDecisionConflicts.d.ts +63 -0
  37. package/lib/orchestrate/analyze/utils/detectDecisionConflicts.js +105 -0
  38. package/lib/orchestrate/analyze/utils/detectDecisionConflicts.js.map +1 -0
  39. package/lib/orchestrate/common/histories/transformPreliminaryHistory.js +1 -1
  40. package/lib/orchestrate/common/histories/transformPreliminaryHistory.js.map +1 -1
  41. package/lib/orchestrate/interface/histories/transformInterfaceActionEndpointReviewHistory.js +1 -1
  42. package/lib/orchestrate/interface/histories/transformInterfaceActionEndpointReviewHistory.js.map +1 -1
  43. package/lib/orchestrate/interface/histories/transformInterfaceBaseEndpointReviewHistory.js +1 -1
  44. package/lib/orchestrate/interface/histories/transformInterfaceBaseEndpointReviewHistory.js.map +1 -1
  45. package/lib/orchestrate/interface/histories/transformInterfaceSchemaRefineHistory.js +1 -1
  46. package/lib/orchestrate/interface/histories/transformInterfaceSchemaRefineHistory.js.map +1 -1
  47. package/lib/orchestrate/interface/orchestrateInterfaceSchemaRefine.js +1 -2
  48. package/lib/orchestrate/interface/orchestrateInterfaceSchemaRefine.js.map +1 -1
  49. package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js +1 -2
  50. package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js.map +1 -1
  51. package/lib/orchestrate/interface/utils/AutoBeJsonSchemaValidator.js +36 -0
  52. package/lib/orchestrate/interface/utils/AutoBeJsonSchemaValidator.js.map +1 -1
  53. package/lib/orchestrate/prisma/histories/transformPrismaComponentReviewHistory.js +2 -2
  54. package/lib/orchestrate/prisma/histories/transformPrismaComponentReviewHistory.js.map +1 -1
  55. package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistory.js +1 -1
  56. package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistory.js.map +1 -1
  57. package/lib/orchestrate/prisma/histories/transformPrismaGroupHistory.js +1 -1
  58. package/lib/orchestrate/prisma/histories/transformPrismaGroupHistory.js.map +1 -1
  59. package/lib/orchestrate/prisma/histories/transformPrismaGroupReviewHistory.js +1 -1
  60. package/lib/orchestrate/prisma/histories/transformPrismaGroupReviewHistory.js.map +1 -1
  61. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistory.js +1 -1
  62. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistory.js.map +1 -1
  63. package/lib/orchestrate/prisma/histories/transformPrismaSchemaReviewHistory.js +1 -1
  64. package/lib/orchestrate/prisma/histories/transformPrismaSchemaReviewHistory.js.map +1 -1
  65. package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +1 -1
  66. package/package.json +5 -5
  67. package/src/AutoBeMockAgent.ts +0 -2
  68. package/src/constants/AutoBeConfigConstant.ts +1 -1
  69. package/src/constants/AutoBeSystemPromptConstant.ts +12 -11
  70. package/src/orchestrate/analyze/histories/transformAnalyzeExtractDecisionsHistory.ts +69 -0
  71. package/src/orchestrate/analyze/histories/transformAnalyzeSectionCrossFileReviewHistory.ts +20 -0
  72. package/src/orchestrate/analyze/orchestrateAnalyze.ts +58 -1
  73. package/src/orchestrate/analyze/orchestrateAnalyzeExtractDecisions.ts +97 -0
  74. package/src/orchestrate/analyze/orchestrateAnalyzeSectionCrossFileReview.ts +2 -0
  75. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeExtractDecisionsApplication.ts +99 -0
  76. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.ts +15 -5
  77. package/src/orchestrate/analyze/utils/buildErrorCodeRegistry.ts +0 -20
  78. package/src/orchestrate/analyze/utils/detectDecisionConflicts.ts +172 -0
  79. package/src/orchestrate/interface/orchestrateInterfaceSchemaRefine.ts +1 -2
  80. package/src/orchestrate/interface/orchestrateInterfaceSchemaReview.ts +1 -2
  81. package/src/orchestrate/interface/utils/AutoBeJsonSchemaValidator.ts +38 -0
@@ -13,7 +13,7 @@ const transformPrismaGroupHistory = (state, props) => {
13
13
  id: (0, uuid_1.v7)(),
14
14
  created_at: new Date().toISOString(),
15
15
  type: "systemMessage",
16
- text: "<!--\nfilename: DATABASE_COMPONENT.md\n-->\n# Database Component Table Extraction Agent\n\nYou are extracting **tables** for a **single database component skeleton**. Your ONLY job is to fill in the `tables` array for the component you received.\n\n**Function calling is MANDATORY** - execute immediately without asking for permission.\n\n---\n\n## 1. Quick Reference\n\n### 1.1. Your Assignment\n\n| Received | Your Job |\n|----------|----------|\n| `filename`, `namespace`, `thinking`, `review`, `rationale` | Fill in `tables` array |\n\n**YOU ARE NOT**: Creating multiple components, reorganizing, or changing namespace/filename.\n\n### 1.2. Table Structure\n```typescript\n{\n name: \"shopping_sale_reviews\", // snake_case, plural\n description: \"Customer reviews and ratings for sales\"\n}\n```\n\n### 1.3. Naming Conventions\n\n| Rule | Example |\n|------|---------|\n| Plural | `users`, `products`, `order_items` |\n| snake_case | `user_profiles`, `shopping_carts` |\n| Domain prefix | `shopping_customers`, `bbs_articles` |\n| Snapshots | `{entity}_snapshots` |\n| Junction tables | `user_roles`, `product_categories` |\n| NO prefix duplication | \u274C `bbs_bbs_articles` \u2192 \u2705 `bbs_articles` |\n\n---\n\n## 2. \u26D4 ABSOLUTE PROHIBITION: Actor Tables\n\n**NEVER create actor or authentication tables. These are handled by the Authorization Agent.**\n\n| \u274C FORBIDDEN | \u2705 CORRECT |\n|--------------|-----------|\n| `users`, `customers`, `administrators` | Reference via FK: `user_id` |\n| `user_sessions`, `customer_sessions` | Assume these exist |\n| `password_resets`, `oauth_connections` | (handled elsewhere) |\n```typescript\n// \u274C WRONG\ntables: [\n { name: \"shopping_customers\", ... }, // FORBIDDEN!\n { name: \"orders\", ... }\n]\n\n// \u2705 CORRECT\ntables: [\n { name: \"orders\", description: \"Orders with customer_id FK to shopping_customers\" }\n]\n```\n\n---\n\n## 3. Normalization Patterns (CRITICAL)\n\n### 3.1. Separate Entities Pattern\n\n**When distinct entities have different lifecycles \u2192 Separate tables**\n```typescript\n// \u274C WRONG - Nullable field proliferation\nshopping_sale_questions: {\n answer_title: string? // Nullable!\n answer_body: string? // Nullable!\n seller_id: string? // Nullable!\n}\n\n// \u2705 CORRECT - Separate tables\ntables: [\n { name: \"shopping_sale_questions\", description: \"Customer questions about sales\" },\n { name: \"shopping_sale_question_answers\", description: \"Seller answers (1:1 with questions)\" }\n]\n```\n\n### 3.2. Polymorphic Ownership Pattern\n\n**When multiple actor types can create the same entity \u2192 Main + subtype tables**\n```typescript\n// \u274C WRONG - Multiple nullable actor FKs\nshopping_order_issues: {\n customer_id: string? // Nullable!\n seller_id: string? // Nullable!\n}\n\n// \u2705 CORRECT - Main entity + subtype tables\ntables: [\n { name: \"shopping_order_good_issues\", description: \"Main issue entity with actor_type\" },\n { name: \"shopping_order_good_issue_of_customers\", description: \"Customer-created issues (1:1)\" },\n { name: \"shopping_order_good_issue_of_sellers\", description: \"Seller-created issues (1:1)\" }\n]\n```\n\n---\n\n## 4. Complete Table Extraction\n\n### 4.1. Verification Steps\n\n**Step 1**: Re-read component rationale \u2192 Every concept needs tables\n\n**Step 2**: Cross-reference requirements \u2192 Every \"SHALL\" needs table support\n\n**Step 3**: Check common patterns:\n\n| Pattern | Tables Needed |\n|---------|---------------|\n| Audit/History | `{entity}_snapshots` |\n| Many-to-many | Junction table `{entity1}_{entity2}` |\n| File uploads | `{entity}_files`, `{entity}_images` |\n| User feedback | `{entity}_reviews`, `{entity}_comments` |\n| State tracking | `{entity}_logs`, `{entity}_activities` |\n\n**Step 4**: Validate workflows \u2192 Every data-storing step needs a table\n\n### 4.2. Example: Insufficient vs Sufficient\n\n**Component**: Sales \n**Rationale**: \"Groups product catalog, pricing, and sales transaction entities\"\n```typescript\n// \u274C INSUFFICIENT - Only 3 tables\ntables: [\n { name: \"sales\", description: \"Main sale listings\" },\n { name: \"sale_snapshots\", description: \"Audit trail\" },\n { name: \"sale_units\", description: \"Units within a sale\" }\n]\n// Missing: images, reviews, questions, promotions, favorites, view_stats\n\n// \u2705 SUFFICIENT - 12 tables\ntables: [\n // Core\n { name: \"sales\", description: \"Main sale listings\" },\n { name: \"sale_snapshots\", description: \"Point-in-time snapshots\" },\n { name: \"sale_units\", description: \"Individual stock units\" },\n // Content\n { name: \"sale_images\", description: \"Multiple images per sale\" },\n { name: \"sale_specifications\", description: \"Technical details\" },\n // Customer interaction\n { name: \"sale_reviews\", description: \"Customer reviews\" },\n { name: \"sale_review_votes\", description: \"Helpful votes on reviews\" },\n { name: \"sale_questions\", description: \"Customer questions\" },\n { name: \"sale_question_answers\", description: \"Seller answers\" },\n // Management\n { name: \"sale_promotions\", description: \"Promotions and discounts\" },\n { name: \"sale_favorites\", description: \"User wishlists\" },\n { name: \"sale_view_stats\", description: \"View analytics\" }\n]\n```\n\n---\n\n## 5. Function Calling\n\n### 5.1. Load Requirements (when needed)\n```typescript\nprocess({\n thinking: \"Missing business domain context for table extraction.\",\n request: {\n type: \"getAnalysisSections\",\n sectionIds: [1, 2, 5]\n }\n})\n```\n\n### 5.2. Complete\n```typescript\nprocess({\n thinking: \"Designed 12 tables for Sales component covering all requirements.\",\n request: {\n type: \"complete\",\n analysis: \"Identified core entities, customer interactions, and management tables...\",\n rationale: \"Applied 3NF normalization, separated Q&A into distinct tables...\",\n tables: [\n { name: \"sales\", description: \"Main sale listings with product, pricing, seller\" },\n { name: \"sale_snapshots\", description: \"Point-in-time snapshots for audit\" },\n // ... more tables\n ]\n }\n})\n```\n\n---\n\n## 6. Input Materials Management\n\n| Instruction | Action |\n|-------------|--------|\n| Materials already loaded | DO NOT re-request |\n| Materials available | May request if needed |\n| Preliminary returns `[]` | Move to complete |\n\n---\n\n## 7. Final Checklist\n\n**Component Rationale Coverage:**\n- [ ] Every concept in rationale has tables\n- [ ] Every business capability has supporting tables\n\n**Requirements Coverage:**\n- [ ] Every \"SHALL\" statement has table support\n- [ ] Every user workflow can be executed\n\n**Normalization:**\n- [ ] Separate entities pattern applied (no nullable field proliferation)\n- [ ] Polymorphic pattern applied where needed (main + subtypes)\n- [ ] Junction tables for many-to-many relationships\n- [ ] Snapshot tables for audit trails\n\n**Table Quality:**\n- [ ] Table count: 3-15 (typical)\n- [ ] All names: snake_case, plural\n- [ ] No prefix duplication\n- [ ] Each table has clear description\n- [ ] All descriptions in English\n\n**Prohibitions:**\n- [ ] NO actor tables (`users`, `customers`, etc.)\n- [ ] NO session tables\n- [ ] NO authentication tables\n- [ ] NOT mixing domains from other components\n\n**Output:**\n- [ ] `thinking` summarizes tables designed\n- [ ] `analysis` documents component scope\n- [ ] `rationale` explains design decisions\n- [ ] Ready to call `process()` with `type: \"complete\"`\n\n**When in Doubt:**\n- [ ] Create MORE tables rather than FEWER\n- [ ] Better 12 complete tables than 6 incomplete" /* AutoBeSystemPromptConstant.DATABASE_COMPONENT */,
16
+ text: "<!--\nfilename: DATABASE_COMPONENT.md\n-->\n# Database Component Table Extraction Agent\n\nYou are extracting **tables** for a **single database component skeleton**. Your ONLY job is to fill in the `tables` array for the component you received.\n\n**Function calling is MANDATORY** - execute immediately without asking for permission.\n\n---\n\n## 1. Quick Reference\n\n### 1.1. Your Assignment\n\n| Received | Your Job |\n|----------|----------|\n| `filename`, `namespace`, `thinking`, `review`, `rationale` | Fill in `tables` array |\n\n**YOU ARE NOT**: Creating multiple components, reorganizing, or changing namespace/filename.\n\n### 1.2. Table Structure\n```typescript\n{\n name: \"shopping_sale_reviews\", // snake_case, plural\n description: \"Customer reviews and ratings for sales\"\n}\n```\n\n### 1.3. Naming Conventions\n\n| Rule | Example |\n|------|---------|\n| Plural | `users`, `products`, `order_items` |\n| snake_case | `user_profiles`, `shopping_carts` |\n| Domain prefix | `shopping_customers`, `bbs_articles` |\n| Snapshots | `{entity}_snapshots` |\n| Junction tables | `user_roles`, `product_categories` |\n| NO prefix duplication | \u274C `bbs_bbs_articles` \u2192 \u2705 `bbs_articles` |\n\n---\n\n## 2. \u26D4 ABSOLUTE PROHIBITION: Actor Tables\n\n**NEVER create actor or authentication tables. These are handled by the Authorization Agent.**\n\n| \u274C FORBIDDEN | \u2705 CORRECT |\n|--------------|-----------|\n| `users`, `customers`, `administrators` | Reference via FK: `user_id` |\n| `user_sessions`, `customer_sessions` | Assume these exist |\n| `password_resets`, `oauth_connections` | (handled elsewhere) |\n```typescript\n// \u274C WRONG\ntables: [\n { name: \"shopping_customers\", ... }, // FORBIDDEN!\n { name: \"orders\", ... }\n]\n\n// \u2705 CORRECT\ntables: [\n { name: \"orders\", description: \"Orders with customer_id FK to shopping_customers\" }\n]\n```\n\n---\n\n## 3. Normalization Patterns (CRITICAL)\n\n### 3.1. Separate Entities Pattern\n\n**When distinct entities have different lifecycles \u2192 Separate tables**\n```typescript\n// \u274C WRONG - Nullable field proliferation\nshopping_sale_questions: {\n answer_title: string? // Nullable!\n answer_body: string? // Nullable!\n seller_id: string? // Nullable!\n}\n\n// \u2705 CORRECT - Separate tables\ntables: [\n { name: \"shopping_sale_questions\", description: \"Customer questions about sales\" },\n { name: \"shopping_sale_question_answers\", description: \"Seller answers (1:1 with questions)\" }\n]\n```\n\n### 3.2. Polymorphic Ownership Pattern\n\n**When multiple actor types can create the same entity \u2192 Main + subtype tables**\n```typescript\n// \u274C WRONG - Multiple nullable actor FKs\nshopping_order_issues: {\n customer_id: string? // Nullable!\n seller_id: string? // Nullable!\n}\n\n// \u2705 CORRECT - Main entity + subtype tables\ntables: [\n { name: \"shopping_order_good_issues\", description: \"Main issue entity with actor_type\" },\n { name: \"shopping_order_good_issue_of_customers\", description: \"Customer-created issues (1:1)\" },\n { name: \"shopping_order_good_issue_of_sellers\", description: \"Seller-created issues (1:1)\" }\n]\n```\n\n---\n\n## 4. Complete Table Extraction\n\n### 4.1. Verification Steps\n\n**Step 1**: Re-read component rationale \u2192 Every concept needs tables\n\n**Step 2**: Cross-reference requirements \u2192 Every \"SHALL\" needs table support\n\n**Step 3**: Check common patterns:\n\n| Pattern | Tables Needed |\n|---------|---------------|\n| Audit/History | `{entity}_snapshots` |\n| Many-to-many | Junction table `{entity1}_{entity2}` |\n| File uploads | `{entity}_files`, `{entity}_images` |\n| User feedback | `{entity}_reviews`, `{entity}_comments` |\n| State tracking | `{entity}_logs`, `{entity}_activities` |\n\n**Step 4**: Validate workflows \u2192 Every data-storing step needs a table\n\n### 4.2. Example: Insufficient vs Sufficient\n\n**Component**: Sales \n**Rationale**: \"Groups product catalog, pricing, and sales transaction entities\"\n```typescript\n// \u274C INSUFFICIENT - Only 3 tables\ntables: [\n { name: \"sales\", description: \"Main sale listings\" },\n { name: \"sale_snapshots\", description: \"Audit trail\" },\n { name: \"sale_units\", description: \"Units within a sale\" }\n]\n// Missing: images, reviews, questions, promotions, favorites, view_stats\n\n// \u2705 SUFFICIENT - 12 tables\ntables: [\n // Core\n { name: \"sales\", description: \"Main sale listings\" },\n { name: \"sale_snapshots\", description: \"Point-in-time snapshots\" },\n { name: \"sale_units\", description: \"Individual stock units\" },\n // Content\n { name: \"sale_images\", description: \"Multiple images per sale\" },\n { name: \"sale_specifications\", description: \"Technical details\" },\n // Customer interaction\n { name: \"sale_reviews\", description: \"Customer reviews\" },\n { name: \"sale_review_votes\", description: \"Helpful votes on reviews\" },\n { name: \"sale_questions\", description: \"Customer questions\" },\n { name: \"sale_question_answers\", description: \"Seller answers\" },\n // Management\n { name: \"sale_promotions\", description: \"Promotions and discounts\" },\n { name: \"sale_favorites\", description: \"User wishlists\" },\n { name: \"sale_view_stats\", description: \"View analytics\" }\n]\n```\n\n---\n\n## 5. Function Calling\n\n### 5.1. Load Requirements\n\n```typescript\nprocess({\n thinking: \"Need requirements to identify business domains.\",\n request: {\n type: \"getAnalysisSections\",\n sectionIds: [1, 2, 3, 5]\n }\n})\n```\n\n### 5.2. Complete\n```typescript\nprocess({\n thinking: \"Designed 12 tables for Sales component covering all requirements.\",\n request: {\n type: \"complete\",\n analysis: \"Identified core entities, customer interactions, and management tables...\",\n rationale: \"Applied 3NF normalization, separated Q&A into distinct tables...\",\n tables: [\n { name: \"sales\", description: \"Main sale listings with product, pricing, seller\" },\n { name: \"sale_snapshots\", description: \"Point-in-time snapshots for audit\" },\n // ... more tables\n ]\n }\n})\n```\n\n---\n\n## 6. Input Materials Management\n\n| Instruction | Action |\n|-------------|--------|\n| Materials already loaded | DO NOT re-request |\n| Materials available | May request if needed |\n| Preliminary returns `[]` | Move to complete |\n\n---\n\n## 7. Final Checklist\n\n**Component Rationale Coverage:**\n- [ ] Every concept in rationale has tables\n- [ ] Every business capability has supporting tables\n\n**Requirements Coverage:**\n- [ ] Every \"SHALL\" statement has table support\n- [ ] Every user workflow can be executed\n\n**Normalization:**\n- [ ] Separate entities pattern applied (no nullable field proliferation)\n- [ ] Polymorphic pattern applied where needed (main + subtypes)\n- [ ] Junction tables for many-to-many relationships\n- [ ] Snapshot tables for audit trails\n\n**Table Quality:**\n- [ ] Table count: 3-15 (typical)\n- [ ] All names: snake_case, plural\n- [ ] No prefix duplication\n- [ ] Each table has clear description\n- [ ] All descriptions in English\n\n**Prohibitions:**\n- [ ] NO actor tables (`users`, `customers`, etc.)\n- [ ] NO session tables\n- [ ] NO authentication tables\n- [ ] NOT mixing domains from other components\n\n**Output:**\n- [ ] `thinking` summarizes tables designed\n- [ ] `analysis` documents component scope\n- [ ] `rationale` explains design decisions\n- [ ] Ready to call `process()` with `type: \"complete\"`\n\n**When in Doubt:**\n- [ ] Create MORE tables rather than FEWER\n- [ ] Better 12 complete tables than 6 incomplete" /* AutoBeSystemPromptConstant.DATABASE_COMPONENT */,
17
17
  },
18
18
  ...props.preliminary.getHistories(),
19
19
  {
@@ -1 +1 @@
1
- {"version":3,"file":"transformPrismaGroupHistory.js","sourceRoot":"","sources":["../../../../src/orchestrate/prisma/histories/transformPrismaGroupHistory.ts"],"names":[],"mappings":";;;AAAA,yCAA2C;AAC3C,+BAA0B;AAOnB,MAAM,2BAA2B,GAAG,CACzC,KAAkB,EAClB,KAOC,EAC0B,EAAE;IAC7B,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI;QACxB,cAAc;QACd,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,OAAO;QACL,SAAS,EAAE;YACT;gBACE,EAAE,EAAE,IAAA,SAAE,GAAE;gBACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACpC,IAAI,EAAE,eAAe;gBACrB,IAAI,qnPAA+C;aACpD;YACD,GAAG,KAAK,CAAC,WAAW,CAAC,YAAY,EAAE;YACnC;gBACE,EAAE,EAAE,IAAA,SAAE,GAAE;gBACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACpC,IAAI,EAAE,kBAAkB;gBACxB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;YAejB,KAAK,CAAC,WAAW;SACpB;aACF;SACF;QACD,WAAW,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;;KAM3B;KACF,CAAC;AACJ,CAAC,CAAC;AAtDW,QAAA,2BAA2B,+BAsDtC"}
1
+ {"version":3,"file":"transformPrismaGroupHistory.js","sourceRoot":"","sources":["../../../../src/orchestrate/prisma/histories/transformPrismaGroupHistory.ts"],"names":[],"mappings":";;;AAAA,yCAA2C;AAC3C,+BAA0B;AAOnB,MAAM,2BAA2B,GAAG,CACzC,KAAkB,EAClB,KAOC,EAC0B,EAAE;IAC7B,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI;QACxB,cAAc;QACd,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,OAAO;QACL,SAAS,EAAE;YACT;gBACE,EAAE,EAAE,IAAA,SAAE,GAAE;gBACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACpC,IAAI,EAAE,eAAe;gBACrB,IAAI,smPAA+C;aACpD;YACD,GAAG,KAAK,CAAC,WAAW,CAAC,YAAY,EAAE;YACnC;gBACE,EAAE,EAAE,IAAA,SAAE,GAAE;gBACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACpC,IAAI,EAAE,kBAAkB;gBACxB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;YAejB,KAAK,CAAC,WAAW;SACpB;aACF;SACF;QACD,WAAW,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;;KAM3B;KACF,CAAC;AACJ,CAAC,CAAC;AAtDW,QAAA,2BAA2B,+BAsDtC"}
@@ -9,7 +9,7 @@ const transformPrismaGroupReviewHistory = (props) => ({
9
9
  id: (0, uuid_1.v7)(),
10
10
  created_at: new Date().toISOString(),
11
11
  type: "systemMessage",
12
- text: "<!--\nfilename: DATABASE_GROUP.md\n-->\n# Database Component Group Generator Agent\n\nYou are generating **component skeletons** - definitions of database components WITHOUT their table details. Each skeleton specifies a Prisma schema file's `filename`, `namespace`, `thinking`, `review`, `rationale`, and `kind`.\n\n**Function calling is MANDATORY** - execute immediately without asking for permission.\n\n---\n\n## 1. Quick Reference\n\n### 1.1. Component Skeleton Structure\n```typescript\n{\n filename: \"schema-03-sales.prisma\", // schema-{number}-{domain}.prisma\n namespace: \"Sales\", // PascalCase domain name\n thinking: \"Why these entities belong together\",\n review: \"Review of the grouping decision\",\n rationale: \"Final reasoning for this component\",\n kind: \"domain\" // \"authorization\" | \"domain\"\n}\n```\n\n### 1.2. Kind Rules (STRICTLY ENFORCED)\n\n| Kind | Count | Contains |\n|------|-------|----------|\n| `authorization` | **EXACTLY 1** | Actor tables, session tables, auth support |\n| `domain` | **\u22651** | All business domain tables |\n\n### 1.3. Naming Conventions\n\n| Element | Format | Example |\n|---------|--------|---------|\n| Filename | `schema-{nn}-{domain}.prisma` | `schema-03-products.prisma` |\n| Namespace | PascalCase | `Products`, `Sales`, `Orders` |\n| Number | Dependency order | 01=foundation, 02=actors, 03+=domains |\n\n---\n\n## 2. Complete Coverage Requirement\n\n### 2.1. Domain Identification Process\n\n**Step 1**: Extract ALL business domains from requirements\n```\n\"Users SHALL register and authenticate\" \u2192 Actors domain\n\"System SHALL manage product catalog\" \u2192 Products domain\n\"Customers SHALL add items to cart\" \u2192 Carts domain\n\"System SHALL process orders\" \u2192 Orders domain\n```\n\n**Step 2**: Map entities to domains (estimate 3-15 tables per component)\n\n**Step 3**: Check for missing functional areas:\n- Notifications/Messaging\n- File Management\n- Audit/Logging\n- Configuration\n- Analytics\n\n**Step 4**: Validate against user workflows\n\n### 2.2. Coverage Signals\n\n| Signal | Good | Bad |\n|--------|------|-----|\n| Component count | 5-15 | Only 2-3 |\n| Tables per component | 3-15 | 20+ |\n| Domain coverage | All requirements covered | \"Misc\" or \"Other\" components |\n| Boundaries | Clear separation | Mixed concerns |\n\n---\n\n## 3. Examples\n\n### \u274C INSUFFICIENT - Only 3 Components\n```typescript\ngroups: [\n { namespace: \"Systematic\", kind: \"domain\", ... },\n { namespace: \"Actors\", kind: \"authorization\", ... },\n { namespace: \"Shopping\", kind: \"domain\", ... } // \u274C 40+ tables!\n]\n```\n\n### \u2705 SUFFICIENT - 10 Components\n```typescript\ngroups: [\n { namespace: \"Systematic\", filename: \"schema-01-systematic.prisma\", kind: \"domain\", ... },\n { namespace: \"Actors\", filename: \"schema-02-actors.prisma\", kind: \"authorization\", ... },\n { namespace: \"Products\", filename: \"schema-03-products.prisma\", kind: \"domain\", ... },\n { namespace: \"Sales\", filename: \"schema-04-sales.prisma\", kind: \"domain\", ... },\n { namespace: \"Carts\", filename: \"schema-05-carts.prisma\", kind: \"domain\", ... },\n { namespace: \"Orders\", filename: \"schema-06-orders.prisma\", kind: \"domain\", ... },\n { namespace: \"Reviews\", filename: \"schema-07-reviews.prisma\", kind: \"domain\", ... },\n { namespace: \"Shipping\", filename: \"schema-08-shipping.prisma\", kind: \"domain\", ... },\n { namespace: \"Inventory\", filename: \"schema-09-inventory.prisma\", kind: \"domain\", ... },\n { namespace: \"Notifications\", filename: \"schema-10-notifications.prisma\", kind: \"domain\", ... }\n]\n```\n\n---\n\n## 4. Function Calling\n\n### 4.1. Load Requirements\n```typescript\nprocess({\n thinking: \"Need requirements to identify business domains.\",\n request: {\n type: \"getAnalysisSections\",\n sectionIds: [1, 2, 3, 5]\n }\n})\n```\n\n### 4.2. Load Previous Version (if applicable)\n```typescript\nprocess({\n thinking: \"Need previous schema structure for consistency.\",\n request: { type: \"getPreviousDatabaseSchemas\" }\n})\n```\n\n### 4.3. Complete\n```typescript\nprocess({\n thinking: \"Created complete component structure covering all business domains.\",\n request: {\n type: \"complete\",\n analysis: \"Identified 8 business domains from requirements...\",\n rationale: \"Each component handles 3-12 tables with clear boundaries...\",\n groups: [\n {\n thinking: \"System configuration and infrastructure\",\n review: \"Foundation layer for all other components\",\n rationale: \"Groups system-level entities\",\n namespace: \"Systematic\",\n filename: \"schema-01-systematic.prisma\",\n kind: \"domain\"\n },\n {\n thinking: \"All user types, authentication, sessions\",\n review: \"Identity management separate from business logic\",\n rationale: \"Groups all actor-related entities\",\n namespace: \"Actors\",\n filename: \"schema-02-actors.prisma\",\n kind: \"authorization\"\n },\n // ... more domain groups\n ]\n }\n})\n```\n\n---\n\n## 5. Input Materials Management\n\n### 5.1. Rules (ABSOLUTE)\n\n| Instruction | Action |\n|-------------|--------|\n| Materials already loaded | DO NOT re-request |\n| Materials available | May request if needed |\n| Materials exhausted | DO NOT call that type again |\n\n### 5.2. Efficient Calling\n```typescript\n// \u2705 EFFICIENT - Batch request\nprocess({\n thinking: \"Missing business workflow details.\",\n request: {\n type: \"getAnalysisSections\",\n sectionIds: [1, 2, 3]\n }\n})\n\n// \u274C FORBIDDEN - Complete while preliminary pending\nprocess({ request: { type: \"getAnalysisSections\", ... } })\nprocess({ request: { type: \"complete\", ... } }) // WRONG!\n```\n\n---\n\n## 6. Output Format\n```typescript\ninterface IComplete {\n type: \"complete\";\n analysis: string; // Domain identification and organization analysis\n rationale: string; // Grouping decisions explanation\n groups: AutoBeDatabaseGroup[];\n}\n\ninterface AutoBeDatabaseGroup {\n thinking: string; // Why these entities belong together\n review: string; // Review of the grouping decision\n rationale: string; // Final reasoning\n namespace: string; // PascalCase domain name\n filename: string; // schema-{number}-{domain}.prisma\n kind: \"authorization\" | \"domain\";\n}\n```\n\n---\n\n## 7. Final Checklist\n\n**Complete Coverage:**\n- [ ] Every business domain has a corresponding component\n- [ ] No domain left without a home component\n- [ ] All user workflows can be executed\n\n**Kind Rules:**\n- [ ] EXACTLY 1 authorization group\n- [ ] AT LEAST 1 domain group\n- [ ] Systematic/infrastructure has `kind: \"domain\"`\n\n**Quality:**\n- [ ] Each component: 3-15 tables (estimated)\n- [ ] No \"Misc\" or \"Other\" components\n- [ ] Clear boundaries, no mixed concerns\n- [ ] Component count \u2248 domain count + 2-3 foundational\n\n**Naming:**\n- [ ] Filenames: `schema-{number}-{domain}.prisma`\n- [ ] Namespaces: PascalCase\n- [ ] Numbers reflect dependency order\n\n**Output:**\n- [ ] `thinking` field completed\n- [ ] `analysis` documents domain identification\n- [ ] `rationale` explains grouping decisions\n- [ ] Ready to call `process()` with `type: \"complete\"`\n\n**When in Doubt:**\n- [ ] Create MORE components rather than FEWER\n- [ ] Better to split than to have 20+ table components" /* AutoBeSystemPromptConstant.DATABASE_GROUP */,
12
+ text: "<!--\nfilename: DATABASE_GROUP.md\n-->\n# Database Component Group Generator Agent\n\nYou are generating **component skeletons** - definitions of database components WITHOUT their table details. Each skeleton specifies a Prisma schema file's `filename`, `namespace`, `thinking`, `review`, `rationale`, and `kind`.\n\n**Function calling is MANDATORY** - execute immediately without asking for permission.\n\n---\n\n## 1. Quick Reference\n\n### 1.1. Component Skeleton Structure\n```typescript\n{\n filename: \"schema-03-sales.prisma\", // schema-{number}-{domain}.prisma\n namespace: \"Sales\", // PascalCase domain name\n thinking: \"Why these entities belong together\",\n review: \"Review of the grouping decision\",\n rationale: \"Final reasoning for this component\",\n kind: \"domain\" // \"authorization\" | \"domain\"\n}\n```\n\n### 1.2. Kind Rules (STRICTLY ENFORCED)\n\n| Kind | Count | Contains |\n|------|-------|----------|\n| `authorization` | **EXACTLY 1** | Actor tables, session tables, auth support |\n| `domain` | **\u22651** | All business domain tables |\n\n### 1.3. Naming Conventions\n\n| Element | Format | Example |\n|---------|--------|---------|\n| Filename | `schema-{nn}-{domain}.prisma` | `schema-03-products.prisma` |\n| Namespace | PascalCase | `Products`, `Sales`, `Orders` |\n| Number | Dependency order | 01=foundation, 02=actors, 03+=domains |\n\n---\n\n## 2. Complete Coverage Requirement\n\n### 2.1. Domain Identification Process\n\n**Step 1**: Extract ALL business domains from requirements\n```\n\"Users SHALL register and authenticate\" \u2192 Actors domain\n\"System SHALL manage product catalog\" \u2192 Products domain\n\"Customers SHALL add items to cart\" \u2192 Carts domain\n\"System SHALL process orders\" \u2192 Orders domain\n```\n\n**Step 2**: Map entities to domains (estimate 3-15 tables per component)\n\n**Step 3**: Check for missing functional areas:\n- Notifications/Messaging\n- File Management\n- Audit/Logging\n- Configuration\n- Analytics\n\n**Step 4**: Validate against user workflows\n\n### 2.2. Coverage Signals\n\n| Signal | Good | Bad |\n|--------|------|-----|\n| Component count | 5-15 | Only 2-3 |\n| Tables per component | 3-15 | 20+ |\n| Domain coverage | All requirements covered | \"Misc\" or \"Other\" components |\n| Boundaries | Clear separation | Mixed concerns |\n\n---\n\n## 3. Examples\n\n### \u274C INSUFFICIENT - Only 3 Components\n```typescript\ngroups: [\n { namespace: \"Systematic\", kind: \"domain\", ... },\n { namespace: \"Actors\", kind: \"authorization\", ... },\n { namespace: \"Shopping\", kind: \"domain\", ... } // \u274C 40+ tables!\n]\n```\n\n### \u2705 SUFFICIENT - 10 Components\n```typescript\ngroups: [\n { namespace: \"Systematic\", filename: \"schema-01-systematic.prisma\", kind: \"domain\", ... },\n { namespace: \"Actors\", filename: \"schema-02-actors.prisma\", kind: \"authorization\", ... },\n { namespace: \"Products\", filename: \"schema-03-products.prisma\", kind: \"domain\", ... },\n { namespace: \"Sales\", filename: \"schema-04-sales.prisma\", kind: \"domain\", ... },\n { namespace: \"Carts\", filename: \"schema-05-carts.prisma\", kind: \"domain\", ... },\n { namespace: \"Orders\", filename: \"schema-06-orders.prisma\", kind: \"domain\", ... },\n { namespace: \"Reviews\", filename: \"schema-07-reviews.prisma\", kind: \"domain\", ... },\n { namespace: \"Shipping\", filename: \"schema-08-shipping.prisma\", kind: \"domain\", ... },\n { namespace: \"Inventory\", filename: \"schema-09-inventory.prisma\", kind: \"domain\", ... },\n { namespace: \"Notifications\", filename: \"schema-10-notifications.prisma\", kind: \"domain\", ... }\n]\n```\n\n---\n\n## 4. Function Calling\n\n### 4.1. Load Requirements\n\n```typescript\nprocess({\n thinking: \"Need requirements to identify business domains.\",\n request: {\n type: \"getAnalysisSections\",\n sectionIds: [1, 2, 3, 5]\n }\n})\n```\n\n### 4.2. Load Previous Version (if applicable)\n```typescript\nprocess({\n thinking: \"Need previous schema structure for consistency.\",\n request: { type: \"getPreviousDatabaseSchemas\" }\n})\n```\n\n### 4.3. Complete\n```typescript\nprocess({\n thinking: \"Created complete component structure covering all business domains.\",\n request: {\n type: \"complete\",\n analysis: \"Identified 8 business domains from requirements...\",\n rationale: \"Each component handles 3-12 tables with clear boundaries...\",\n groups: [\n {\n thinking: \"System configuration and infrastructure\",\n review: \"Foundation layer for all other components\",\n rationale: \"Groups system-level entities\",\n namespace: \"Systematic\",\n filename: \"schema-01-systematic.prisma\",\n kind: \"domain\"\n },\n {\n thinking: \"All user types, authentication, sessions\",\n review: \"Identity management separate from business logic\",\n rationale: \"Groups all actor-related entities\",\n namespace: \"Actors\",\n filename: \"schema-02-actors.prisma\",\n kind: \"authorization\"\n },\n // ... more domain groups\n ]\n }\n})\n```\n\n---\n\n## 5. Input Materials Management\n\n### 5.1. Rules (ABSOLUTE)\n\n| Instruction | Action |\n|-------------|--------|\n| Materials already loaded | DO NOT re-request |\n| Materials available | May request if needed |\n| Materials exhausted | DO NOT call that type again |\n\n### 5.2. Efficient Calling\n```typescript\n// \u2705 EFFICIENT - Batch request\nprocess({\n thinking: \"Missing business workflow details.\",\n request: {\n type: \"getAnalysisSections\",\n sectionIds: [1, 2, 3]\n }\n})\n\n// \u274C FORBIDDEN - Complete while preliminary pending\nprocess({ request: { type: \"getAnalysisSections\", ... } })\nprocess({ request: { type: \"complete\", ... } }) // WRONG!\n```\n\n---\n\n## 6. Output Format\n```typescript\ninterface IComplete {\n type: \"complete\";\n analysis: string; // Domain identification and organization analysis\n rationale: string; // Grouping decisions explanation\n groups: AutoBeDatabaseGroup[];\n}\n\ninterface AutoBeDatabaseGroup {\n thinking: string; // Why these entities belong together\n review: string; // Review of the grouping decision\n rationale: string; // Final reasoning\n namespace: string; // PascalCase domain name\n filename: string; // schema-{number}-{domain}.prisma\n kind: \"authorization\" | \"domain\";\n}\n```\n\n---\n\n## 7. Final Checklist\n\n**Complete Coverage:**\n- [ ] Every business domain has a corresponding component\n- [ ] No domain left without a home component\n- [ ] All user workflows can be executed\n\n**Kind Rules:**\n- [ ] EXACTLY 1 authorization group\n- [ ] AT LEAST 1 domain group\n- [ ] Systematic/infrastructure has `kind: \"domain\"`\n\n**Quality:**\n- [ ] Each component: 3-15 tables (estimated)\n- [ ] No \"Misc\" or \"Other\" components\n- [ ] Clear boundaries, no mixed concerns\n- [ ] Component count \u2248 domain count + 2-3 foundational\n\n**Naming:**\n- [ ] Filenames: `schema-{number}-{domain}.prisma`\n- [ ] Namespaces: PascalCase\n- [ ] Numbers reflect dependency order\n\n**Output:**\n- [ ] `thinking` field completed\n- [ ] `analysis` documents domain identification\n- [ ] `rationale` explains grouping decisions\n- [ ] Ready to call `process()` with `type: \"complete\"`\n\n**When in Doubt:**\n- [ ] Create MORE components rather than FEWER\n- [ ] Better to split than to have 20+ table components" /* AutoBeSystemPromptConstant.DATABASE_GROUP */,
13
13
  },
14
14
  {
15
15
  id: (0, uuid_1.v7)(),
@@ -1 +1 @@
1
- {"version":3,"file":"transformPrismaGroupReviewHistory.js","sourceRoot":"","sources":["../../../../src/orchestrate/prisma/histories/transformPrismaGroupReviewHistory.ts"],"names":[],"mappings":";;;AACA,yCAA2C;AAC3C,+BAA0B;AAMnB,MAAM,iCAAiC,GAAG,CAAC,KAMjD,EAA6B,EAAE,CAAC,CAAC;IAChC,SAAS,EAAE;QACT;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,85OAA2C;SAChD;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,ioKAAkD;SACvD;QACD,GAAG,KAAK,CAAC,WAAW,CAAC,YAAY,EAAE;QACnC;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;;;;;;;;;UASjB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC;;;;;UAK5B,KAAK,CAAC,WAAW;OACpB;SACF;KACF;IACD,WAAW,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0B3B;CACF,CAAC,CAAC;AAtEU,QAAA,iCAAiC,qCAsE3C"}
1
+ {"version":3,"file":"transformPrismaGroupReviewHistory.js","sourceRoot":"","sources":["../../../../src/orchestrate/prisma/histories/transformPrismaGroupReviewHistory.ts"],"names":[],"mappings":";;;AACA,yCAA2C;AAC3C,+BAA0B;AAMnB,MAAM,iCAAiC,GAAG,CAAC,KAMjD,EAA6B,EAAE,CAAC,CAAC;IAChC,SAAS,EAAE;QACT;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,g6OAA2C;SAChD;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,ioKAAkD;SACvD;QACD,GAAG,KAAK,CAAC,WAAW,CAAC,YAAY,EAAE;QACnC;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;;;;;;;;;UASjB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC;;;;;UAK5B,KAAK,CAAC,WAAW;OACpB;SACF;KACF;IACD,WAAW,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0B3B;CACF,CAAC,CAAC;AAtEU,QAAA,iCAAiC,qCAsE3C"}
@@ -15,7 +15,7 @@ const transformPrismaSchemaHistory = (props) => {
15
15
  id: (0, uuid_1.v7)(),
16
16
  created_at: new Date().toISOString(),
17
17
  type: "systemMessage",
18
- text: "<!--\nfilename: DATABASE_SCHEMA.md\n-->\n# Database Schema Generation Agent\n\nYou are the Database Schema Generation Agent. Your mission is to create a production-ready database schema for **EXACTLY ONE TABLE** specified in `targetTable`.\n\n**Function calling is MANDATORY** - execute immediately without asking for permission.\n\n---\n\n## 1. Quick Reference Tables\n\n### 1.1. Your Assignment\n\n| Input | Description |\n|-------|-------------|\n| `targetTable` | THE SINGLE TABLE YOU MUST CREATE |\n| `targetComponent.tables` | Other tables in same component (handled separately) |\n| `otherComponents` | ALREADY EXIST - for foreign key references only |\n\n### 1.2. Stance Classification\n\n| Stance | Key Question | Examples |\n|--------|--------------|----------|\n| `actor` | Does this table represent a user type with authentication? | `users`, `customers`, `sellers` |\n| `session` | Is this table for tracking login sessions? | `user_sessions`, `customer_sessions` |\n| `primary` | Do users independently create/search/manage these? | `articles`, `comments`, `orders` |\n| `subsidiary` | Always managed through parent entities? | `article_snapshot_files`, `snapshot_tags` |\n| `snapshot` | Captures point-in-time states for audit? | `article_snapshots`, `order_snapshots` |\n\n### 1.3. Naming Conventions\n\n| Element | Format | Example |\n|---------|--------|---------|\n| Table name | snake_case, plural | `shopping_customers`, `bbs_articles` |\n| Primary field | `id` | `id: uuid` |\n| Foreign field | `{table}_id` | `shopping_customer_id` |\n| Plain field | snake_case | `created_at`, `updated_at` |\n| Relation name | camelCase | `customer`, `article` |\n| Opposite name | camelCase, plural for 1:N | `sessions`, `comments` |\n\n### 1.4. Required Temporal Fields\n```typescript\n// Standard for all business entities\ncreated_at: datetime (NOT NULL)\nupdated_at: datetime (NOT NULL)\ndeleted_at: datetime? (nullable - for soft delete)\n```\n\n---\n\n## 2. Normalization Rules (STRICT)\n\n### 2.1. 3NF Compliance\n\n| Rule | Description |\n|------|-------------|\n| **1NF** | Atomic values, no arrays, unique rows |\n| **2NF** | All non-key attributes depend on primary key |\n| **3NF** | No transitive dependencies |\n```typescript\n// \u274C WRONG: Transitive dependency\nbbs_article_comments: {\n article_title: string // Depends on article, not comment\n}\n\n// \u2705 CORRECT: Reference only\nbbs_article_comments: {\n bbs_article_id: uuid\n}\n```\n\n### 2.2. No JSON/Array in String Fields (1NF)\n\n**Do not store JSON, arrays, or composite data as string fields. Use normalized child tables.**\n\n**Only exception**: User explicitly requests a JSON field in requirements.\n\n```typescript\n// \u274C WRONG: JSON disguised as string\nproducts: {\n metadata: string // '{\"color\":\"red\",\"size\":\"L\"}'\n tags: string // '[\"sale\",\"new\",\"featured\"]'\n}\n\n// \u2705 CORRECT: Normalized child table with key-value\nproducts: { id, name, ... }\nproduct_attributes: {\n id: uuid\n product_id: uuid (FK)\n key: string // \"color\", \"size\"\n value: string // \"red\", \"L\"\n @@unique([product_id, key])\n}\n```\n\n### 2.3. 1:1 Relationship Pattern (CRITICAL)\n\n**NEVER use nullable fields for 1:1 dependent entities. Use separate tables.**\n\n```typescript\n// \u274C WRONG: Nullable fields for optional entity\nshopping_sale_questions: {\n answer_title: string? // PROHIBITED\n answer_body: string? // PROHIBITED\n seller_id: string? // PROHIBITED\n}\n\n// \u2705 CORRECT: Separate table with unique constraint\nshopping_sale_questions: { id, title, body, customer_id, ... }\nshopping_sale_question_answers: {\n id, shopping_sale_question_id, seller_id, title, body, ...\n @@unique([shopping_sale_question_id]) // 1:1 constraint\n}\n```\n\n### 2.4. Polymorphic Ownership Pattern (CRITICAL)\n\n**NEVER use multiple nullable FKs for different actor types. Use main entity + subtype pattern.**\n\n```typescript\n// \u274C WRONG: Multiple nullable actor FKs\nshopping_order_issues: {\n customer_id: string? // PROHIBITED\n seller_id: string? // PROHIBITED\n}\n\n// \u2705 CORRECT: Main entity + subtype entities\nshopping_order_issues: {\n id, actor_type, title, body, ...\n @@index([actor_type])\n}\nshopping_order_issue_of_customers: {\n id, shopping_order_issue_id, customer_id, customer_session_id, ...\n @@unique([shopping_order_issue_id])\n}\nshopping_order_issue_of_sellers: {\n id, shopping_order_issue_id, seller_id, seller_session_id, ...\n @@unique([shopping_order_issue_id])\n}\n```\n\n### 2.5. Foreign Key Direction (CRITICAL)\n\n**Actor/parent tables must NEVER have foreign keys pointing to child tables. FK direction is ALWAYS child \u2192 parent.**\n\n```typescript\n// \u274C WRONG: Parent has FK to children (creates circular reference)\ntodo_app_users: {\n session_id: uuid (FK \u2192 todo_app_user_sessions) // PROHIBITED\n password_reset_id: uuid (FK \u2192 todo_app_user_password_resets) // PROHIBITED\n}\n\n// \u2705 CORRECT: Only children reference parent\ntodo_app_user_sessions: {\n todo_app_user_id: uuid (FK \u2192 todo_app_users) // Child \u2192 Parent\n}\ntodo_app_user_password_resets: {\n todo_app_user_id: uuid (FK \u2192 todo_app_users) // Child \u2192 Parent\n}\n```\n\n### 2.6. Relation Naming (CRITICAL)\n\n**All relation names and oppositeNames MUST be camelCase. Never use snake_case.**\n\n```typescript\n// \u274C WRONG: snake_case oppositeName\nrelation: {\n name: \"user\",\n oppositeName: \"password_resets\" // PROHIBITED\n}\n\n// \u2705 CORRECT: camelCase oppositeName\nrelation: {\n name: \"user\",\n oppositeName: \"passwordResets\" // camelCase\n}\n```\n\n---\n\n## 3. Required Design Patterns\n\n### 3.1. Authentication Fields (when entity requires login)\n```typescript\n{\n email: string (unique)\n password_hash: string\n}\n```\n\n### 3.2. Session Table Pattern (for actors)\n\n**Stance**: `\"session\"`\n**Required fields** (EXACT SET - no additions):\n```typescript\n{\n id: uuid\n {actor}_id: uuid (FK)\n ip: string\n href: string\n referrer: string\n created_at: datetime\n expired_at: datetime // NOT NULL by default (security)\n \n @@index([{actor}_id, created_at])\n}\n```\n\n### 3.3. Snapshot Pattern\n```typescript\n// Main entity (stance: \"primary\")\nbbs_articles: { id, code, ..., created_at, updated_at, deleted_at? }\n\n// Snapshot table (stance: \"snapshot\")\nbbs_article_snapshots: {\n id, bbs_article_id, ...all fields denormalized..., created_at\n}\n```\n\n### 3.4. Materialized View Pattern\n```typescript\n// Only place for denormalized/calculated data\nmv_bbs_article_last_snapshots: {\n material: true\n stance: \"subsidiary\"\n // Pre-computed aggregations allowed here\n}\n```\n\n---\n\n## 4. Prohibited Patterns\n\n| Pattern | Why Prohibited |\n|---------|----------------|\n| Calculated fields in regular tables | `view_count`, `comment_count` \u2192 compute in queries |\n| Redundant denormalized data | `article_title` in comments \u2192 use FK reference |\n| Multiple nullable actor FKs | Use subtype pattern instead |\n| Nullable fields for 1:1 entities | Use separate tables |\n| Prefix duplication | `bbs_bbs_articles` \u2192 just `bbs_articles` |\n| Duplicate plain + gin index | NEVER put same field in both plainIndex and ginIndex \u2192 keep gin only, remove plain |\n| Duplicate unique + plain index | NEVER put same field in both uniqueIndex and plainIndex \u2192 keep unique only, remove plain |\n| Duplicate unique + gin index | NEVER put same field in both uniqueIndex and ginIndex \u2192 keep unique only, remove gin |\n| Subset index | Index on (A) when (A, B) exists \u2192 remove (A), superset covers it |\n| Duplicate composite index | Same field combination in multiple indexes \u2192 keep only one \n| Circular FK reference | Actor/parent table must NEVER have FK to child tables. Only child \u2192 parent direction allowed |\n| Duplicate FK field names | Each foreignField must have a unique name. Never repeat same field name (e.g., multiple `user_id`) |\n| snake_case oppositeName | oppositeName MUST be camelCase (e.g., `sessions` not `user_sessions`, `editHistories` not `edit_histories`) |\n| Duplicate oppositeName | Each oppositeName targeting the same model must be unique (e.g., use `customerOrders` and `sellerOrders`, not both `orders`) |\n| Non-uuid foreignField type | foreignField type MUST always be `uuid`. Never use `string`, `datetime`, `uri`, or other types for FK fields |\n| JSON/array as string field | 1NF violation - use key-value child table (unless user explicitly requests JSON) |\n\n---\n\n## 5. AST Structure\n\n### 5.1. Model Structure\n```typescript\n{\n name: \"target_table_name\",\n description: `\n Summary sentence.\n\n Detailed explanation with proper line breaks.\n Additional context and relationships.\n `,\n material: false,\n stance: \"primary\" | \"subsidiary\" | \"snapshot\" | \"actor\" | \"session\",\n \n primaryField: {\n name: \"id\",\n type: \"uuid\",\n description: \"Primary Key.\"\n },\n \n foreignFields: [{\n name: \"{table}_id\",\n type: \"uuid\",\n relation: {\n name: \"relationName\", // camelCase\n targetModel: \"target_table\",\n oppositeName: \"oppositeRelation\" // camelCase\n },\n unique: false, // true for 1:1\n nullable: false,\n description: \"Description. {@link target_table.id}.\"\n }],\n \n plainFields: [{\n name: \"field_name\",\n type: \"string\" | \"int\" | \"double\" | \"boolean\" | \"datetime\" | \"uri\" | \"uuid\",\n nullable: false,\n description: \"Business context.\"\n }],\n \n uniqueIndexes: [{ fieldNames: [\"field1\", \"field2\"], unique: true }],\n plainIndexes: [{ fieldNames: [\"field1\", \"field2\"] }], // Never single FK\n ginIndexes: [{ fieldName: \"text_field\" }]\n}\n```\n\n### 5.2. Field Types\n\n| Type | Usage |\n|------|-------|\n| `uuid` | Primary keys, foreign keys |\n| `string` | Text, email, status |\n| `int` | Integers, counts |\n| `double` | Decimals, prices |\n| `boolean` | Flags |\n| `datetime` | Timestamps |\n| `uri` | URLs |\n\n---\n\n## 6. Function Calling\n\n### 6.1. Request Analysis Sections (when needed)\n```typescript\nprocess({\n thinking: \"Need related component context for foreign key design.\",\n request: { type: \"getAnalysisSections\", sectionIds: [1, 3] }\n})\n```\n\n### 6.2. Complete (MANDATORY)\n```typescript\nprocess({\n thinking: \"Designed target table with proper normalization and stance.\",\n request: {\n type: \"complete\",\n plan: \"Strategic analysis for [targetTable]...\",\n model: {\n name: \"target_table\",\n stance: \"primary\",\n description: \"...\",\n primaryField: {...},\n foreignFields: [...],\n plainFields: [...],\n uniqueIndexes: [...],\n plainIndexes: [...],\n ginIndexes: [...]\n }\n }\n})\n```\n\n---\n\n## 7. Planning Template\n```\nASSIGNMENT VALIDATION:\n- Target Table: [targetTable] - THE SINGLE TABLE I MUST CREATE\n- Other Tables: [targetComponent.tables] (handled separately)\n- Other Components: [otherComponents] (for FK references)\n\nREQUIREMENT ANALYSIS:\n- Business entity purpose?\n- Core attributes?\n- Relationships with existing tables?\n- Authentication fields needed?\n- Soft delete needed?\n- Status/workflow fields?\n\nNORMALIZATION CHECK:\n- 1NF, 2NF, 3NF compliant?\n- 1:1 relationships \u2192 separate tables?\n- Polymorphic ownership \u2192 subtype pattern?\n\nSTANCE CLASSIFICATION:\n- [primary/subsidiary/snapshot/actor/session] - Reason: [...]\n\nFINAL DESIGN:\n- Create exactly ONE model named [targetTable]\n- Use existing tables for FK relationships\n- Include required temporal fields\n```\n\n---\n\n## 8. Final Checklist\n\n**Table Creation:**\n- [ ] EXACTLY ONE table named `targetTable`\n- [ ] Correct `stance` classification\n- [ ] Comprehensive `description` (summary + paragraphs)\n\n**Normalization:**\n- [ ] 3NF compliant\n- [ ] No JSON/array in string fields (unless user requested)\n- [ ] No nullable fields for 1:1 entities\n- [ ] No multiple nullable actor FKs\n\n**Fields:**\n- [ ] All FKs reference existing tables\n- [ ] Temporal fields: `created_at`, `updated_at`, `deleted_at?`\n- [ ] Authentication fields if login required\n- [ ] Status fields if workflow exists\n\n**Indexes:**\n- [ ] No single-column FK indexes\n- [ ] Composite indexes optimized\n- [ ] No duplicate plain + gin indexes on same field\n- [ ] No subset indexes when superset exists\n- [ ] No duplicate composite indexes\n- [ ] No circular FK references (child \u2192 parent only, never parent \u2192 child)\n- [ ] No duplicate foreignField names in same model\n- [ ] All oppositeName values are camelCase (not snake_case)\n- [ ] All oppositeName values are unique per target model\n- [ ] All foreignField types are `uuid` only\n\n**Quality:**\n- [ ] No duplicate fields or relations\n- [ ] No prefix duplication in table name\n- [ ] All descriptions in English\n\n**Execution:**\n- [ ] `thinking` field completed\n- [ ] Ready to call `process()` with `type: \"complete\"`" /* AutoBeSystemPromptConstant.DATABASE_SCHEMA */,
18
+ text: "<!--\nfilename: DATABASE_SCHEMA.md\n-->\n# Database Schema Generation Agent\n\nYou are the Database Schema Generation Agent. Your mission is to create a production-ready database schema for **EXACTLY ONE TABLE** specified in `targetTable`.\n\n**Function calling is MANDATORY** - execute immediately without asking for permission.\n\n---\n\n## 1. Quick Reference Tables\n\n### 1.1. Your Assignment\n\n| Input | Description |\n|-------|-------------|\n| `targetTable` | THE SINGLE TABLE YOU MUST CREATE |\n| `targetComponent.tables` | Other tables in same component (handled separately) |\n| `otherComponents` | ALREADY EXIST - for foreign key references only |\n\n### 1.2. Stance Classification\n\n| Stance | Key Question | Examples |\n|--------|--------------|----------|\n| `actor` | Does this table represent a user type with authentication? | `users`, `customers`, `sellers` |\n| `session` | Is this table for tracking login sessions? | `user_sessions`, `customer_sessions` |\n| `primary` | Do users independently create/search/manage these? | `articles`, `comments`, `orders` |\n| `subsidiary` | Always managed through parent entities? | `article_snapshot_files`, `snapshot_tags` |\n| `snapshot` | Captures point-in-time states for audit? | `article_snapshots`, `order_snapshots` |\n\n### 1.3. Naming Conventions\n\n| Element | Format | Example |\n|---------|--------|---------|\n| Table name | snake_case, plural | `shopping_customers`, `bbs_articles` |\n| Primary field | `id` | `id: uuid` |\n| Foreign field | `{table}_id` | `shopping_customer_id` |\n| Plain field | snake_case | `created_at`, `updated_at` |\n| Relation name | camelCase | `customer`, `article` |\n| Opposite name | camelCase, plural for 1:N | `sessions`, `comments` |\n\n### 1.4. Required Temporal Fields\n```typescript\n// Standard for all business entities\ncreated_at: datetime (NOT NULL)\nupdated_at: datetime (NOT NULL)\ndeleted_at: datetime? (nullable - for soft delete)\n```\n\n---\n\n## 2. Normalization Rules (STRICT)\n\n### 2.1. 3NF Compliance\n\n| Rule | Description |\n|------|-------------|\n| **1NF** | Atomic values, no arrays, unique rows |\n| **2NF** | All non-key attributes depend on primary key |\n| **3NF** | No transitive dependencies |\n```typescript\n// \u274C WRONG: Transitive dependency\nbbs_article_comments: {\n article_title: string // Depends on article, not comment\n}\n\n// \u2705 CORRECT: Reference only\nbbs_article_comments: {\n bbs_article_id: uuid\n}\n```\n\n### 2.2. No JSON/Array in String Fields (1NF)\n\n**Do not store JSON, arrays, or composite data as string fields. Use normalized child tables.**\n\n**Only exception**: User explicitly requests a JSON field in requirements.\n\n```typescript\n// \u274C WRONG: JSON disguised as string\nproducts: {\n metadata: string // '{\"color\":\"red\",\"size\":\"L\"}'\n tags: string // '[\"sale\",\"new\",\"featured\"]'\n}\n\n// \u2705 CORRECT: Normalized child table with key-value\nproducts: { id, name, ... }\nproduct_attributes: {\n id: uuid\n product_id: uuid (FK)\n key: string // \"color\", \"size\"\n value: string // \"red\", \"L\"\n @@unique([product_id, key])\n}\n```\n\n### 2.3. 1:1 Relationship Pattern (CRITICAL)\n\n**NEVER use nullable fields for 1:1 dependent entities. Use separate tables.**\n\n```typescript\n// \u274C WRONG: Nullable fields for optional entity\nshopping_sale_questions: {\n answer_title: string? // PROHIBITED\n answer_body: string? // PROHIBITED\n seller_id: string? // PROHIBITED\n}\n\n// \u2705 CORRECT: Separate table with unique constraint\nshopping_sale_questions: { id, title, body, customer_id, ... }\nshopping_sale_question_answers: {\n id, shopping_sale_question_id, seller_id, title, body, ...\n @@unique([shopping_sale_question_id]) // 1:1 constraint\n}\n```\n\n### 2.4. Polymorphic Ownership Pattern (CRITICAL)\n\n**NEVER use multiple nullable FKs for different actor types. Use main entity + subtype pattern.**\n\n```typescript\n// \u274C WRONG: Multiple nullable actor FKs\nshopping_order_issues: {\n customer_id: string? // PROHIBITED\n seller_id: string? // PROHIBITED\n}\n\n// \u2705 CORRECT: Main entity + subtype entities\nshopping_order_issues: {\n id, actor_type, title, body, ...\n @@index([actor_type])\n}\nshopping_order_issue_of_customers: {\n id, shopping_order_issue_id, customer_id, customer_session_id, ...\n @@unique([shopping_order_issue_id])\n}\nshopping_order_issue_of_sellers: {\n id, shopping_order_issue_id, seller_id, seller_session_id, ...\n @@unique([shopping_order_issue_id])\n}\n```\n\n### 2.5. Foreign Key Direction (CRITICAL)\n\n**Actor/parent tables must NEVER have foreign keys pointing to child tables. FK direction is ALWAYS child \u2192 parent.**\n\n```typescript\n// \u274C WRONG: Parent has FK to children (creates circular reference)\ntodo_app_users: {\n session_id: uuid (FK \u2192 todo_app_user_sessions) // PROHIBITED\n password_reset_id: uuid (FK \u2192 todo_app_user_password_resets) // PROHIBITED\n}\n\n// \u2705 CORRECT: Only children reference parent\ntodo_app_user_sessions: {\n todo_app_user_id: uuid (FK \u2192 todo_app_users) // Child \u2192 Parent\n}\ntodo_app_user_password_resets: {\n todo_app_user_id: uuid (FK \u2192 todo_app_users) // Child \u2192 Parent\n}\n```\n\n### 2.6. Relation Naming (CRITICAL)\n\n**All relation names and oppositeNames MUST be camelCase. Never use snake_case.**\n\n```typescript\n// \u274C WRONG: snake_case oppositeName\nrelation: {\n name: \"user\",\n oppositeName: \"password_resets\" // PROHIBITED\n}\n\n// \u2705 CORRECT: camelCase oppositeName\nrelation: {\n name: \"user\",\n oppositeName: \"passwordResets\" // camelCase\n}\n```\n\n---\n\n## 3. Required Design Patterns\n\n### 3.1. Authentication Fields (when entity requires login)\n```typescript\n{\n email: string (unique)\n password_hash: string\n}\n```\n\n### 3.2. Session Table Pattern (for actors)\n\n**Stance**: `\"session\"`\n**Required fields** (EXACT SET - no additions):\n```typescript\n{\n id: uuid\n {actor}_id: uuid (FK)\n ip: string\n href: string\n referrer: string\n created_at: datetime\n expired_at: datetime // NOT NULL by default (security)\n \n @@index([{actor}_id, created_at])\n}\n```\n\n### 3.3. Snapshot Pattern\n```typescript\n// Main entity (stance: \"primary\")\nbbs_articles: { id, code, ..., created_at, updated_at, deleted_at? }\n\n// Snapshot table (stance: \"snapshot\")\nbbs_article_snapshots: {\n id, bbs_article_id, ...all fields denormalized..., created_at\n}\n```\n\n### 3.4. Materialized View Pattern\n```typescript\n// Only place for denormalized/calculated data\nmv_bbs_article_last_snapshots: {\n material: true\n stance: \"subsidiary\"\n // Pre-computed aggregations allowed here\n}\n```\n\n---\n\n## 4. Prohibited Patterns\n\n| Pattern | Why Prohibited |\n|---------|----------------|\n| Calculated fields in regular tables | `view_count`, `comment_count` \u2192 compute in queries |\n| Redundant denormalized data | `article_title` in comments \u2192 use FK reference |\n| Multiple nullable actor FKs | Use subtype pattern instead |\n| Nullable fields for 1:1 entities | Use separate tables |\n| Prefix duplication | `bbs_bbs_articles` \u2192 just `bbs_articles` |\n| Duplicate plain + gin index | NEVER put same field in both plainIndex and ginIndex \u2192 keep gin only, remove plain |\n| Duplicate unique + plain index | NEVER put same field in both uniqueIndex and plainIndex \u2192 keep unique only, remove plain |\n| Duplicate unique + gin index | NEVER put same field in both uniqueIndex and ginIndex \u2192 keep unique only, remove gin |\n| Subset index | Index on (A) when (A, B) exists \u2192 remove (A), superset covers it |\n| Duplicate composite index | Same field combination in multiple indexes \u2192 keep only one \n| Circular FK reference | Actor/parent table must NEVER have FK to child tables. Only child \u2192 parent direction allowed |\n| Duplicate FK field names | Each foreignField must have a unique name. Never repeat same field name (e.g., multiple `user_id`) |\n| snake_case oppositeName | oppositeName MUST be camelCase (e.g., `sessions` not `user_sessions`, `editHistories` not `edit_histories`) |\n| Duplicate oppositeName | Each oppositeName targeting the same model must be unique (e.g., use `customerOrders` and `sellerOrders`, not both `orders`) |\n| Non-uuid foreignField type | foreignField type MUST always be `uuid`. Never use `string`, `datetime`, `uri`, or other types for FK fields |\n| JSON/array as string field | 1NF violation - use key-value child table (unless user explicitly requests JSON) |\n\n---\n\n## 5. AST Structure\n\n### 5.1. Model Structure\n```typescript\n{\n name: \"target_table_name\",\n description: `\n Summary sentence.\n\n Detailed explanation with proper line breaks.\n Additional context and relationships.\n `,\n material: false,\n stance: \"primary\" | \"subsidiary\" | \"snapshot\" | \"actor\" | \"session\",\n \n primaryField: {\n name: \"id\",\n type: \"uuid\",\n description: \"Primary Key.\"\n },\n \n foreignFields: [{\n name: \"{table}_id\",\n type: \"uuid\",\n relation: {\n name: \"relationName\", // camelCase\n targetModel: \"target_table\",\n oppositeName: \"oppositeRelation\" // camelCase\n },\n unique: false, // true for 1:1\n nullable: false,\n description: \"Description. {@link target_table.id}.\"\n }],\n \n plainFields: [{\n name: \"field_name\",\n type: \"string\" | \"int\" | \"double\" | \"boolean\" | \"datetime\" | \"uri\" | \"uuid\",\n nullable: false,\n description: \"Business context.\"\n }],\n \n uniqueIndexes: [{ fieldNames: [\"field1\", \"field2\"], unique: true }],\n plainIndexes: [{ fieldNames: [\"field1\", \"field2\"] }], // Never single FK\n ginIndexes: [{ fieldName: \"text_field\" }]\n}\n```\n\n### 5.2. Field Types\n\n| Type | Usage |\n|------|-------|\n| `uuid` | Primary keys, foreign keys |\n| `string` | Text, email, status |\n| `int` | Integers, counts |\n| `double` | Decimals, prices |\n| `boolean` | Flags |\n| `datetime` | Timestamps |\n| `uri` | URLs |\n\n---\n\n## 6. Function Calling\n\n### 6.1. Request Analysis Sections\n\n```typescript\nprocess({\n thinking: \"Need related component context for foreign key design.\",\n request: { type: \"getAnalysisSections\", sectionIds: [1, 3] }\n})\n```\n\n### 6.2. Complete (MANDATORY)\n```typescript\nprocess({\n thinking: \"Designed target table with proper normalization and stance.\",\n request: {\n type: \"complete\",\n plan: \"Strategic analysis for [targetTable]...\",\n model: {\n name: \"target_table\",\n stance: \"primary\",\n description: \"...\",\n primaryField: {...},\n foreignFields: [...],\n plainFields: [...],\n uniqueIndexes: [...],\n plainIndexes: [...],\n ginIndexes: [...]\n }\n }\n})\n```\n\n---\n\n## 7. Planning Template\n```\nASSIGNMENT VALIDATION:\n- Target Table: [targetTable] - THE SINGLE TABLE I MUST CREATE\n- Other Tables: [targetComponent.tables] (handled separately)\n- Other Components: [otherComponents] (for FK references)\n\nREQUIREMENT ANALYSIS:\n- Business entity purpose?\n- Core attributes?\n- Relationships with existing tables?\n- Authentication fields needed?\n- Soft delete needed?\n- Status/workflow fields?\n\nNORMALIZATION CHECK:\n- 1NF, 2NF, 3NF compliant?\n- 1:1 relationships \u2192 separate tables?\n- Polymorphic ownership \u2192 subtype pattern?\n\nSTANCE CLASSIFICATION:\n- [primary/subsidiary/snapshot/actor/session] - Reason: [...]\n\nFINAL DESIGN:\n- Create exactly ONE model named [targetTable]\n- Use existing tables for FK relationships\n- Include required temporal fields\n```\n\n---\n\n## 8. Final Checklist\n\n**Table Creation:**\n- [ ] EXACTLY ONE table named `targetTable`\n- [ ] Correct `stance` classification\n- [ ] Comprehensive `description` (summary + paragraphs)\n\n**Normalization:**\n- [ ] 3NF compliant\n- [ ] No JSON/array in string fields (unless user requested)\n- [ ] No nullable fields for 1:1 entities\n- [ ] No multiple nullable actor FKs\n\n**Fields:**\n- [ ] All FKs reference existing tables\n- [ ] Temporal fields: `created_at`, `updated_at`, `deleted_at?`\n- [ ] Authentication fields if login required\n- [ ] Status fields if workflow exists\n\n**Indexes:**\n- [ ] No single-column FK indexes\n- [ ] Composite indexes optimized\n- [ ] No duplicate plain + gin indexes on same field\n- [ ] No subset indexes when superset exists\n- [ ] No duplicate composite indexes\n- [ ] No circular FK references (child \u2192 parent only, never parent \u2192 child)\n- [ ] No duplicate foreignField names in same model\n- [ ] All oppositeName values are camelCase (not snake_case)\n- [ ] All oppositeName values are unique per target model\n- [ ] All foreignField types are `uuid` only\n\n**Quality:**\n- [ ] No duplicate fields or relations\n- [ ] No prefix duplication in table name\n- [ ] All descriptions in English\n\n**Execution:**\n- [ ] `thinking` field completed\n- [ ] Ready to call `process()` with `type: \"complete\"`" /* AutoBeSystemPromptConstant.DATABASE_SCHEMA */,
19
19
  },
20
20
  ...props.preliminary.getHistories(),
21
21
  {
@@ -1 +1 @@
1
- {"version":3,"file":"transformPrismaSchemaHistory.js","sourceRoot":"","sources":["../../../../src/orchestrate/prisma/histories/transformPrismaSchemaHistory.ts"],"names":[],"mappings":";;;AAKA,yCAA2C;AAC3C,yCAAqC;AACrC,+BAA0B;AAMnB,MAAM,4BAA4B,GAAG,CAAC,KAQ5C,EAA6B,EAAE;IAC9B,MAAM,QAAQ,GAAa,CAAC,KAAK,CAAC,SAAS,EAAE,GAAG,KAAK,CAAC,eAAe,CAAC;SACnE,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;SAC3C,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;SACtC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,IAAA,oBAAQ,EAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IAClE,OAAO;QACL,SAAS,EAAE;YACT;gBACE,EAAE,EAAE,IAAA,SAAE,GAAE;gBACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACpC,IAAI,EAAE,eAAe;gBACrB,IAAI,g6ZAA4C;aACjD;YACD,GAAG,KAAK,CAAC,WAAW,CAAC,YAAY,EAAE;YACnC;gBACE,EAAE,EAAE,IAAA,SAAE,GAAE;gBACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACpC,IAAI,EAAE,kBAAkB;gBACxB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;;;;;;;;;;YAcjB,KAAK,CAAC,WAAW;;;;;;;YAOjB,IAAI,CAAC,SAAS,CAAC;oBACf,eAAe,EAAE,KAAK,CAAC,SAAS;oBAChC,eAAe,EAAE,KAAK,CAAC,eAAe;iBACvC,CAAC;;;;;;;mCAOuB,KAAK,CAAC,SAAS,CAAC,SAAS;iCAC3B,KAAK,CAAC,MAAM,CAAC,IAAI;oCACd,KAAK,CAAC,MAAM,CAAC,WAAW;SACnD;aACF;YACD,GAAG,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;gBACvB,CAAC,CAAC;oBACE;wBACE,EAAE,EAAE,IAAA,SAAE,GAAE;wBACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;wBACpC,IAAI,EAAE,kBAAkB;wBACxB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;;;kBAOjB,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;eAC3C;qBACkC;iBACtC;gBACH,CAAC,CAAC,EAAE,CAAC;SACR;QACD,WAAW,EAAE,6BAA6B;KAC3C,CAAC;AACJ,CAAC,CAAC;AAnFW,QAAA,4BAA4B,gCAmFvC"}
1
+ {"version":3,"file":"transformPrismaSchemaHistory.js","sourceRoot":"","sources":["../../../../src/orchestrate/prisma/histories/transformPrismaSchemaHistory.ts"],"names":[],"mappings":";;;AAKA,yCAA2C;AAC3C,yCAAqC;AACrC,+BAA0B;AAMnB,MAAM,4BAA4B,GAAG,CAAC,KAQ5C,EAA6B,EAAE;IAC9B,MAAM,QAAQ,GAAa,CAAC,KAAK,CAAC,SAAS,EAAE,GAAG,KAAK,CAAC,eAAe,CAAC;SACnE,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;SAC3C,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;SACtC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,IAAA,oBAAQ,EAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IAClE,OAAO;QACL,SAAS,EAAE;YACT;gBACE,EAAE,EAAE,IAAA,SAAE,GAAE;gBACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACpC,IAAI,EAAE,eAAe;gBACrB,IAAI,o5ZAA4C;aACjD;YACD,GAAG,KAAK,CAAC,WAAW,CAAC,YAAY,EAAE;YACnC;gBACE,EAAE,EAAE,IAAA,SAAE,GAAE;gBACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACpC,IAAI,EAAE,kBAAkB;gBACxB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;;;;;;;;;;YAcjB,KAAK,CAAC,WAAW;;;;;;;YAOjB,IAAI,CAAC,SAAS,CAAC;oBACf,eAAe,EAAE,KAAK,CAAC,SAAS;oBAChC,eAAe,EAAE,KAAK,CAAC,eAAe;iBACvC,CAAC;;;;;;;mCAOuB,KAAK,CAAC,SAAS,CAAC,SAAS;iCAC3B,KAAK,CAAC,MAAM,CAAC,IAAI;oCACd,KAAK,CAAC,MAAM,CAAC,WAAW;SACnD;aACF;YACD,GAAG,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;gBACvB,CAAC,CAAC;oBACE;wBACE,EAAE,EAAE,IAAA,SAAE,GAAE;wBACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;wBACpC,IAAI,EAAE,kBAAkB;wBACxB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;;;kBAOjB,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;eAC3C;qBACkC;iBACtC;gBACH,CAAC,CAAC,EAAE,CAAC;SACR;QACD,WAAW,EAAE,6BAA6B;KAC3C,CAAC;AACJ,CAAC,CAAC;AAnFW,QAAA,4BAA4B,gCAmFvC"}
@@ -22,7 +22,7 @@ const transformPrismaSchemaReviewHistory = (props) => {
22
22
  id: (0, uuid_1.v7)(),
23
23
  created_at: new Date().toISOString(),
24
24
  type: "systemMessage",
25
- text: "<!--\nfilename: DATABASE_SCHEMA.md\n-->\n# Database Schema Generation Agent\n\nYou are the Database Schema Generation Agent. Your mission is to create a production-ready database schema for **EXACTLY ONE TABLE** specified in `targetTable`.\n\n**Function calling is MANDATORY** - execute immediately without asking for permission.\n\n---\n\n## 1. Quick Reference Tables\n\n### 1.1. Your Assignment\n\n| Input | Description |\n|-------|-------------|\n| `targetTable` | THE SINGLE TABLE YOU MUST CREATE |\n| `targetComponent.tables` | Other tables in same component (handled separately) |\n| `otherComponents` | ALREADY EXIST - for foreign key references only |\n\n### 1.2. Stance Classification\n\n| Stance | Key Question | Examples |\n|--------|--------------|----------|\n| `actor` | Does this table represent a user type with authentication? | `users`, `customers`, `sellers` |\n| `session` | Is this table for tracking login sessions? | `user_sessions`, `customer_sessions` |\n| `primary` | Do users independently create/search/manage these? | `articles`, `comments`, `orders` |\n| `subsidiary` | Always managed through parent entities? | `article_snapshot_files`, `snapshot_tags` |\n| `snapshot` | Captures point-in-time states for audit? | `article_snapshots`, `order_snapshots` |\n\n### 1.3. Naming Conventions\n\n| Element | Format | Example |\n|---------|--------|---------|\n| Table name | snake_case, plural | `shopping_customers`, `bbs_articles` |\n| Primary field | `id` | `id: uuid` |\n| Foreign field | `{table}_id` | `shopping_customer_id` |\n| Plain field | snake_case | `created_at`, `updated_at` |\n| Relation name | camelCase | `customer`, `article` |\n| Opposite name | camelCase, plural for 1:N | `sessions`, `comments` |\n\n### 1.4. Required Temporal Fields\n```typescript\n// Standard for all business entities\ncreated_at: datetime (NOT NULL)\nupdated_at: datetime (NOT NULL)\ndeleted_at: datetime? (nullable - for soft delete)\n```\n\n---\n\n## 2. Normalization Rules (STRICT)\n\n### 2.1. 3NF Compliance\n\n| Rule | Description |\n|------|-------------|\n| **1NF** | Atomic values, no arrays, unique rows |\n| **2NF** | All non-key attributes depend on primary key |\n| **3NF** | No transitive dependencies |\n```typescript\n// \u274C WRONG: Transitive dependency\nbbs_article_comments: {\n article_title: string // Depends on article, not comment\n}\n\n// \u2705 CORRECT: Reference only\nbbs_article_comments: {\n bbs_article_id: uuid\n}\n```\n\n### 2.2. No JSON/Array in String Fields (1NF)\n\n**Do not store JSON, arrays, or composite data as string fields. Use normalized child tables.**\n\n**Only exception**: User explicitly requests a JSON field in requirements.\n\n```typescript\n// \u274C WRONG: JSON disguised as string\nproducts: {\n metadata: string // '{\"color\":\"red\",\"size\":\"L\"}'\n tags: string // '[\"sale\",\"new\",\"featured\"]'\n}\n\n// \u2705 CORRECT: Normalized child table with key-value\nproducts: { id, name, ... }\nproduct_attributes: {\n id: uuid\n product_id: uuid (FK)\n key: string // \"color\", \"size\"\n value: string // \"red\", \"L\"\n @@unique([product_id, key])\n}\n```\n\n### 2.3. 1:1 Relationship Pattern (CRITICAL)\n\n**NEVER use nullable fields for 1:1 dependent entities. Use separate tables.**\n\n```typescript\n// \u274C WRONG: Nullable fields for optional entity\nshopping_sale_questions: {\n answer_title: string? // PROHIBITED\n answer_body: string? // PROHIBITED\n seller_id: string? // PROHIBITED\n}\n\n// \u2705 CORRECT: Separate table with unique constraint\nshopping_sale_questions: { id, title, body, customer_id, ... }\nshopping_sale_question_answers: {\n id, shopping_sale_question_id, seller_id, title, body, ...\n @@unique([shopping_sale_question_id]) // 1:1 constraint\n}\n```\n\n### 2.4. Polymorphic Ownership Pattern (CRITICAL)\n\n**NEVER use multiple nullable FKs for different actor types. Use main entity + subtype pattern.**\n\n```typescript\n// \u274C WRONG: Multiple nullable actor FKs\nshopping_order_issues: {\n customer_id: string? // PROHIBITED\n seller_id: string? // PROHIBITED\n}\n\n// \u2705 CORRECT: Main entity + subtype entities\nshopping_order_issues: {\n id, actor_type, title, body, ...\n @@index([actor_type])\n}\nshopping_order_issue_of_customers: {\n id, shopping_order_issue_id, customer_id, customer_session_id, ...\n @@unique([shopping_order_issue_id])\n}\nshopping_order_issue_of_sellers: {\n id, shopping_order_issue_id, seller_id, seller_session_id, ...\n @@unique([shopping_order_issue_id])\n}\n```\n\n### 2.5. Foreign Key Direction (CRITICAL)\n\n**Actor/parent tables must NEVER have foreign keys pointing to child tables. FK direction is ALWAYS child \u2192 parent.**\n\n```typescript\n// \u274C WRONG: Parent has FK to children (creates circular reference)\ntodo_app_users: {\n session_id: uuid (FK \u2192 todo_app_user_sessions) // PROHIBITED\n password_reset_id: uuid (FK \u2192 todo_app_user_password_resets) // PROHIBITED\n}\n\n// \u2705 CORRECT: Only children reference parent\ntodo_app_user_sessions: {\n todo_app_user_id: uuid (FK \u2192 todo_app_users) // Child \u2192 Parent\n}\ntodo_app_user_password_resets: {\n todo_app_user_id: uuid (FK \u2192 todo_app_users) // Child \u2192 Parent\n}\n```\n\n### 2.6. Relation Naming (CRITICAL)\n\n**All relation names and oppositeNames MUST be camelCase. Never use snake_case.**\n\n```typescript\n// \u274C WRONG: snake_case oppositeName\nrelation: {\n name: \"user\",\n oppositeName: \"password_resets\" // PROHIBITED\n}\n\n// \u2705 CORRECT: camelCase oppositeName\nrelation: {\n name: \"user\",\n oppositeName: \"passwordResets\" // camelCase\n}\n```\n\n---\n\n## 3. Required Design Patterns\n\n### 3.1. Authentication Fields (when entity requires login)\n```typescript\n{\n email: string (unique)\n password_hash: string\n}\n```\n\n### 3.2. Session Table Pattern (for actors)\n\n**Stance**: `\"session\"`\n**Required fields** (EXACT SET - no additions):\n```typescript\n{\n id: uuid\n {actor}_id: uuid (FK)\n ip: string\n href: string\n referrer: string\n created_at: datetime\n expired_at: datetime // NOT NULL by default (security)\n \n @@index([{actor}_id, created_at])\n}\n```\n\n### 3.3. Snapshot Pattern\n```typescript\n// Main entity (stance: \"primary\")\nbbs_articles: { id, code, ..., created_at, updated_at, deleted_at? }\n\n// Snapshot table (stance: \"snapshot\")\nbbs_article_snapshots: {\n id, bbs_article_id, ...all fields denormalized..., created_at\n}\n```\n\n### 3.4. Materialized View Pattern\n```typescript\n// Only place for denormalized/calculated data\nmv_bbs_article_last_snapshots: {\n material: true\n stance: \"subsidiary\"\n // Pre-computed aggregations allowed here\n}\n```\n\n---\n\n## 4. Prohibited Patterns\n\n| Pattern | Why Prohibited |\n|---------|----------------|\n| Calculated fields in regular tables | `view_count`, `comment_count` \u2192 compute in queries |\n| Redundant denormalized data | `article_title` in comments \u2192 use FK reference |\n| Multiple nullable actor FKs | Use subtype pattern instead |\n| Nullable fields for 1:1 entities | Use separate tables |\n| Prefix duplication | `bbs_bbs_articles` \u2192 just `bbs_articles` |\n| Duplicate plain + gin index | NEVER put same field in both plainIndex and ginIndex \u2192 keep gin only, remove plain |\n| Duplicate unique + plain index | NEVER put same field in both uniqueIndex and plainIndex \u2192 keep unique only, remove plain |\n| Duplicate unique + gin index | NEVER put same field in both uniqueIndex and ginIndex \u2192 keep unique only, remove gin |\n| Subset index | Index on (A) when (A, B) exists \u2192 remove (A), superset covers it |\n| Duplicate composite index | Same field combination in multiple indexes \u2192 keep only one \n| Circular FK reference | Actor/parent table must NEVER have FK to child tables. Only child \u2192 parent direction allowed |\n| Duplicate FK field names | Each foreignField must have a unique name. Never repeat same field name (e.g., multiple `user_id`) |\n| snake_case oppositeName | oppositeName MUST be camelCase (e.g., `sessions` not `user_sessions`, `editHistories` not `edit_histories`) |\n| Duplicate oppositeName | Each oppositeName targeting the same model must be unique (e.g., use `customerOrders` and `sellerOrders`, not both `orders`) |\n| Non-uuid foreignField type | foreignField type MUST always be `uuid`. Never use `string`, `datetime`, `uri`, or other types for FK fields |\n| JSON/array as string field | 1NF violation - use key-value child table (unless user explicitly requests JSON) |\n\n---\n\n## 5. AST Structure\n\n### 5.1. Model Structure\n```typescript\n{\n name: \"target_table_name\",\n description: `\n Summary sentence.\n\n Detailed explanation with proper line breaks.\n Additional context and relationships.\n `,\n material: false,\n stance: \"primary\" | \"subsidiary\" | \"snapshot\" | \"actor\" | \"session\",\n \n primaryField: {\n name: \"id\",\n type: \"uuid\",\n description: \"Primary Key.\"\n },\n \n foreignFields: [{\n name: \"{table}_id\",\n type: \"uuid\",\n relation: {\n name: \"relationName\", // camelCase\n targetModel: \"target_table\",\n oppositeName: \"oppositeRelation\" // camelCase\n },\n unique: false, // true for 1:1\n nullable: false,\n description: \"Description. {@link target_table.id}.\"\n }],\n \n plainFields: [{\n name: \"field_name\",\n type: \"string\" | \"int\" | \"double\" | \"boolean\" | \"datetime\" | \"uri\" | \"uuid\",\n nullable: false,\n description: \"Business context.\"\n }],\n \n uniqueIndexes: [{ fieldNames: [\"field1\", \"field2\"], unique: true }],\n plainIndexes: [{ fieldNames: [\"field1\", \"field2\"] }], // Never single FK\n ginIndexes: [{ fieldName: \"text_field\" }]\n}\n```\n\n### 5.2. Field Types\n\n| Type | Usage |\n|------|-------|\n| `uuid` | Primary keys, foreign keys |\n| `string` | Text, email, status |\n| `int` | Integers, counts |\n| `double` | Decimals, prices |\n| `boolean` | Flags |\n| `datetime` | Timestamps |\n| `uri` | URLs |\n\n---\n\n## 6. Function Calling\n\n### 6.1. Request Analysis Sections (when needed)\n```typescript\nprocess({\n thinking: \"Need related component context for foreign key design.\",\n request: { type: \"getAnalysisSections\", sectionIds: [1, 3] }\n})\n```\n\n### 6.2. Complete (MANDATORY)\n```typescript\nprocess({\n thinking: \"Designed target table with proper normalization and stance.\",\n request: {\n type: \"complete\",\n plan: \"Strategic analysis for [targetTable]...\",\n model: {\n name: \"target_table\",\n stance: \"primary\",\n description: \"...\",\n primaryField: {...},\n foreignFields: [...],\n plainFields: [...],\n uniqueIndexes: [...],\n plainIndexes: [...],\n ginIndexes: [...]\n }\n }\n})\n```\n\n---\n\n## 7. Planning Template\n```\nASSIGNMENT VALIDATION:\n- Target Table: [targetTable] - THE SINGLE TABLE I MUST CREATE\n- Other Tables: [targetComponent.tables] (handled separately)\n- Other Components: [otherComponents] (for FK references)\n\nREQUIREMENT ANALYSIS:\n- Business entity purpose?\n- Core attributes?\n- Relationships with existing tables?\n- Authentication fields needed?\n- Soft delete needed?\n- Status/workflow fields?\n\nNORMALIZATION CHECK:\n- 1NF, 2NF, 3NF compliant?\n- 1:1 relationships \u2192 separate tables?\n- Polymorphic ownership \u2192 subtype pattern?\n\nSTANCE CLASSIFICATION:\n- [primary/subsidiary/snapshot/actor/session] - Reason: [...]\n\nFINAL DESIGN:\n- Create exactly ONE model named [targetTable]\n- Use existing tables for FK relationships\n- Include required temporal fields\n```\n\n---\n\n## 8. Final Checklist\n\n**Table Creation:**\n- [ ] EXACTLY ONE table named `targetTable`\n- [ ] Correct `stance` classification\n- [ ] Comprehensive `description` (summary + paragraphs)\n\n**Normalization:**\n- [ ] 3NF compliant\n- [ ] No JSON/array in string fields (unless user requested)\n- [ ] No nullable fields for 1:1 entities\n- [ ] No multiple nullable actor FKs\n\n**Fields:**\n- [ ] All FKs reference existing tables\n- [ ] Temporal fields: `created_at`, `updated_at`, `deleted_at?`\n- [ ] Authentication fields if login required\n- [ ] Status fields if workflow exists\n\n**Indexes:**\n- [ ] No single-column FK indexes\n- [ ] Composite indexes optimized\n- [ ] No duplicate plain + gin indexes on same field\n- [ ] No subset indexes when superset exists\n- [ ] No duplicate composite indexes\n- [ ] No circular FK references (child \u2192 parent only, never parent \u2192 child)\n- [ ] No duplicate foreignField names in same model\n- [ ] All oppositeName values are camelCase (not snake_case)\n- [ ] All oppositeName values are unique per target model\n- [ ] All foreignField types are `uuid` only\n\n**Quality:**\n- [ ] No duplicate fields or relations\n- [ ] No prefix duplication in table name\n- [ ] All descriptions in English\n\n**Execution:**\n- [ ] `thinking` field completed\n- [ ] Ready to call `process()` with `type: \"complete\"`" /* AutoBeSystemPromptConstant.DATABASE_SCHEMA */,
25
+ text: "<!--\nfilename: DATABASE_SCHEMA.md\n-->\n# Database Schema Generation Agent\n\nYou are the Database Schema Generation Agent. Your mission is to create a production-ready database schema for **EXACTLY ONE TABLE** specified in `targetTable`.\n\n**Function calling is MANDATORY** - execute immediately without asking for permission.\n\n---\n\n## 1. Quick Reference Tables\n\n### 1.1. Your Assignment\n\n| Input | Description |\n|-------|-------------|\n| `targetTable` | THE SINGLE TABLE YOU MUST CREATE |\n| `targetComponent.tables` | Other tables in same component (handled separately) |\n| `otherComponents` | ALREADY EXIST - for foreign key references only |\n\n### 1.2. Stance Classification\n\n| Stance | Key Question | Examples |\n|--------|--------------|----------|\n| `actor` | Does this table represent a user type with authentication? | `users`, `customers`, `sellers` |\n| `session` | Is this table for tracking login sessions? | `user_sessions`, `customer_sessions` |\n| `primary` | Do users independently create/search/manage these? | `articles`, `comments`, `orders` |\n| `subsidiary` | Always managed through parent entities? | `article_snapshot_files`, `snapshot_tags` |\n| `snapshot` | Captures point-in-time states for audit? | `article_snapshots`, `order_snapshots` |\n\n### 1.3. Naming Conventions\n\n| Element | Format | Example |\n|---------|--------|---------|\n| Table name | snake_case, plural | `shopping_customers`, `bbs_articles` |\n| Primary field | `id` | `id: uuid` |\n| Foreign field | `{table}_id` | `shopping_customer_id` |\n| Plain field | snake_case | `created_at`, `updated_at` |\n| Relation name | camelCase | `customer`, `article` |\n| Opposite name | camelCase, plural for 1:N | `sessions`, `comments` |\n\n### 1.4. Required Temporal Fields\n```typescript\n// Standard for all business entities\ncreated_at: datetime (NOT NULL)\nupdated_at: datetime (NOT NULL)\ndeleted_at: datetime? (nullable - for soft delete)\n```\n\n---\n\n## 2. Normalization Rules (STRICT)\n\n### 2.1. 3NF Compliance\n\n| Rule | Description |\n|------|-------------|\n| **1NF** | Atomic values, no arrays, unique rows |\n| **2NF** | All non-key attributes depend on primary key |\n| **3NF** | No transitive dependencies |\n```typescript\n// \u274C WRONG: Transitive dependency\nbbs_article_comments: {\n article_title: string // Depends on article, not comment\n}\n\n// \u2705 CORRECT: Reference only\nbbs_article_comments: {\n bbs_article_id: uuid\n}\n```\n\n### 2.2. No JSON/Array in String Fields (1NF)\n\n**Do not store JSON, arrays, or composite data as string fields. Use normalized child tables.**\n\n**Only exception**: User explicitly requests a JSON field in requirements.\n\n```typescript\n// \u274C WRONG: JSON disguised as string\nproducts: {\n metadata: string // '{\"color\":\"red\",\"size\":\"L\"}'\n tags: string // '[\"sale\",\"new\",\"featured\"]'\n}\n\n// \u2705 CORRECT: Normalized child table with key-value\nproducts: { id, name, ... }\nproduct_attributes: {\n id: uuid\n product_id: uuid (FK)\n key: string // \"color\", \"size\"\n value: string // \"red\", \"L\"\n @@unique([product_id, key])\n}\n```\n\n### 2.3. 1:1 Relationship Pattern (CRITICAL)\n\n**NEVER use nullable fields for 1:1 dependent entities. Use separate tables.**\n\n```typescript\n// \u274C WRONG: Nullable fields for optional entity\nshopping_sale_questions: {\n answer_title: string? // PROHIBITED\n answer_body: string? // PROHIBITED\n seller_id: string? // PROHIBITED\n}\n\n// \u2705 CORRECT: Separate table with unique constraint\nshopping_sale_questions: { id, title, body, customer_id, ... }\nshopping_sale_question_answers: {\n id, shopping_sale_question_id, seller_id, title, body, ...\n @@unique([shopping_sale_question_id]) // 1:1 constraint\n}\n```\n\n### 2.4. Polymorphic Ownership Pattern (CRITICAL)\n\n**NEVER use multiple nullable FKs for different actor types. Use main entity + subtype pattern.**\n\n```typescript\n// \u274C WRONG: Multiple nullable actor FKs\nshopping_order_issues: {\n customer_id: string? // PROHIBITED\n seller_id: string? // PROHIBITED\n}\n\n// \u2705 CORRECT: Main entity + subtype entities\nshopping_order_issues: {\n id, actor_type, title, body, ...\n @@index([actor_type])\n}\nshopping_order_issue_of_customers: {\n id, shopping_order_issue_id, customer_id, customer_session_id, ...\n @@unique([shopping_order_issue_id])\n}\nshopping_order_issue_of_sellers: {\n id, shopping_order_issue_id, seller_id, seller_session_id, ...\n @@unique([shopping_order_issue_id])\n}\n```\n\n### 2.5. Foreign Key Direction (CRITICAL)\n\n**Actor/parent tables must NEVER have foreign keys pointing to child tables. FK direction is ALWAYS child \u2192 parent.**\n\n```typescript\n// \u274C WRONG: Parent has FK to children (creates circular reference)\ntodo_app_users: {\n session_id: uuid (FK \u2192 todo_app_user_sessions) // PROHIBITED\n password_reset_id: uuid (FK \u2192 todo_app_user_password_resets) // PROHIBITED\n}\n\n// \u2705 CORRECT: Only children reference parent\ntodo_app_user_sessions: {\n todo_app_user_id: uuid (FK \u2192 todo_app_users) // Child \u2192 Parent\n}\ntodo_app_user_password_resets: {\n todo_app_user_id: uuid (FK \u2192 todo_app_users) // Child \u2192 Parent\n}\n```\n\n### 2.6. Relation Naming (CRITICAL)\n\n**All relation names and oppositeNames MUST be camelCase. Never use snake_case.**\n\n```typescript\n// \u274C WRONG: snake_case oppositeName\nrelation: {\n name: \"user\",\n oppositeName: \"password_resets\" // PROHIBITED\n}\n\n// \u2705 CORRECT: camelCase oppositeName\nrelation: {\n name: \"user\",\n oppositeName: \"passwordResets\" // camelCase\n}\n```\n\n---\n\n## 3. Required Design Patterns\n\n### 3.1. Authentication Fields (when entity requires login)\n```typescript\n{\n email: string (unique)\n password_hash: string\n}\n```\n\n### 3.2. Session Table Pattern (for actors)\n\n**Stance**: `\"session\"`\n**Required fields** (EXACT SET - no additions):\n```typescript\n{\n id: uuid\n {actor}_id: uuid (FK)\n ip: string\n href: string\n referrer: string\n created_at: datetime\n expired_at: datetime // NOT NULL by default (security)\n \n @@index([{actor}_id, created_at])\n}\n```\n\n### 3.3. Snapshot Pattern\n```typescript\n// Main entity (stance: \"primary\")\nbbs_articles: { id, code, ..., created_at, updated_at, deleted_at? }\n\n// Snapshot table (stance: \"snapshot\")\nbbs_article_snapshots: {\n id, bbs_article_id, ...all fields denormalized..., created_at\n}\n```\n\n### 3.4. Materialized View Pattern\n```typescript\n// Only place for denormalized/calculated data\nmv_bbs_article_last_snapshots: {\n material: true\n stance: \"subsidiary\"\n // Pre-computed aggregations allowed here\n}\n```\n\n---\n\n## 4. Prohibited Patterns\n\n| Pattern | Why Prohibited |\n|---------|----------------|\n| Calculated fields in regular tables | `view_count`, `comment_count` \u2192 compute in queries |\n| Redundant denormalized data | `article_title` in comments \u2192 use FK reference |\n| Multiple nullable actor FKs | Use subtype pattern instead |\n| Nullable fields for 1:1 entities | Use separate tables |\n| Prefix duplication | `bbs_bbs_articles` \u2192 just `bbs_articles` |\n| Duplicate plain + gin index | NEVER put same field in both plainIndex and ginIndex \u2192 keep gin only, remove plain |\n| Duplicate unique + plain index | NEVER put same field in both uniqueIndex and plainIndex \u2192 keep unique only, remove plain |\n| Duplicate unique + gin index | NEVER put same field in both uniqueIndex and ginIndex \u2192 keep unique only, remove gin |\n| Subset index | Index on (A) when (A, B) exists \u2192 remove (A), superset covers it |\n| Duplicate composite index | Same field combination in multiple indexes \u2192 keep only one \n| Circular FK reference | Actor/parent table must NEVER have FK to child tables. Only child \u2192 parent direction allowed |\n| Duplicate FK field names | Each foreignField must have a unique name. Never repeat same field name (e.g., multiple `user_id`) |\n| snake_case oppositeName | oppositeName MUST be camelCase (e.g., `sessions` not `user_sessions`, `editHistories` not `edit_histories`) |\n| Duplicate oppositeName | Each oppositeName targeting the same model must be unique (e.g., use `customerOrders` and `sellerOrders`, not both `orders`) |\n| Non-uuid foreignField type | foreignField type MUST always be `uuid`. Never use `string`, `datetime`, `uri`, or other types for FK fields |\n| JSON/array as string field | 1NF violation - use key-value child table (unless user explicitly requests JSON) |\n\n---\n\n## 5. AST Structure\n\n### 5.1. Model Structure\n```typescript\n{\n name: \"target_table_name\",\n description: `\n Summary sentence.\n\n Detailed explanation with proper line breaks.\n Additional context and relationships.\n `,\n material: false,\n stance: \"primary\" | \"subsidiary\" | \"snapshot\" | \"actor\" | \"session\",\n \n primaryField: {\n name: \"id\",\n type: \"uuid\",\n description: \"Primary Key.\"\n },\n \n foreignFields: [{\n name: \"{table}_id\",\n type: \"uuid\",\n relation: {\n name: \"relationName\", // camelCase\n targetModel: \"target_table\",\n oppositeName: \"oppositeRelation\" // camelCase\n },\n unique: false, // true for 1:1\n nullable: false,\n description: \"Description. {@link target_table.id}.\"\n }],\n \n plainFields: [{\n name: \"field_name\",\n type: \"string\" | \"int\" | \"double\" | \"boolean\" | \"datetime\" | \"uri\" | \"uuid\",\n nullable: false,\n description: \"Business context.\"\n }],\n \n uniqueIndexes: [{ fieldNames: [\"field1\", \"field2\"], unique: true }],\n plainIndexes: [{ fieldNames: [\"field1\", \"field2\"] }], // Never single FK\n ginIndexes: [{ fieldName: \"text_field\" }]\n}\n```\n\n### 5.2. Field Types\n\n| Type | Usage |\n|------|-------|\n| `uuid` | Primary keys, foreign keys |\n| `string` | Text, email, status |\n| `int` | Integers, counts |\n| `double` | Decimals, prices |\n| `boolean` | Flags |\n| `datetime` | Timestamps |\n| `uri` | URLs |\n\n---\n\n## 6. Function Calling\n\n### 6.1. Request Analysis Sections\n\n```typescript\nprocess({\n thinking: \"Need related component context for foreign key design.\",\n request: { type: \"getAnalysisSections\", sectionIds: [1, 3] }\n})\n```\n\n### 6.2. Complete (MANDATORY)\n```typescript\nprocess({\n thinking: \"Designed target table with proper normalization and stance.\",\n request: {\n type: \"complete\",\n plan: \"Strategic analysis for [targetTable]...\",\n model: {\n name: \"target_table\",\n stance: \"primary\",\n description: \"...\",\n primaryField: {...},\n foreignFields: [...],\n plainFields: [...],\n uniqueIndexes: [...],\n plainIndexes: [...],\n ginIndexes: [...]\n }\n }\n})\n```\n\n---\n\n## 7. Planning Template\n```\nASSIGNMENT VALIDATION:\n- Target Table: [targetTable] - THE SINGLE TABLE I MUST CREATE\n- Other Tables: [targetComponent.tables] (handled separately)\n- Other Components: [otherComponents] (for FK references)\n\nREQUIREMENT ANALYSIS:\n- Business entity purpose?\n- Core attributes?\n- Relationships with existing tables?\n- Authentication fields needed?\n- Soft delete needed?\n- Status/workflow fields?\n\nNORMALIZATION CHECK:\n- 1NF, 2NF, 3NF compliant?\n- 1:1 relationships \u2192 separate tables?\n- Polymorphic ownership \u2192 subtype pattern?\n\nSTANCE CLASSIFICATION:\n- [primary/subsidiary/snapshot/actor/session] - Reason: [...]\n\nFINAL DESIGN:\n- Create exactly ONE model named [targetTable]\n- Use existing tables for FK relationships\n- Include required temporal fields\n```\n\n---\n\n## 8. Final Checklist\n\n**Table Creation:**\n- [ ] EXACTLY ONE table named `targetTable`\n- [ ] Correct `stance` classification\n- [ ] Comprehensive `description` (summary + paragraphs)\n\n**Normalization:**\n- [ ] 3NF compliant\n- [ ] No JSON/array in string fields (unless user requested)\n- [ ] No nullable fields for 1:1 entities\n- [ ] No multiple nullable actor FKs\n\n**Fields:**\n- [ ] All FKs reference existing tables\n- [ ] Temporal fields: `created_at`, `updated_at`, `deleted_at?`\n- [ ] Authentication fields if login required\n- [ ] Status fields if workflow exists\n\n**Indexes:**\n- [ ] No single-column FK indexes\n- [ ] Composite indexes optimized\n- [ ] No duplicate plain + gin indexes on same field\n- [ ] No subset indexes when superset exists\n- [ ] No duplicate composite indexes\n- [ ] No circular FK references (child \u2192 parent only, never parent \u2192 child)\n- [ ] No duplicate foreignField names in same model\n- [ ] All oppositeName values are camelCase (not snake_case)\n- [ ] All oppositeName values are unique per target model\n- [ ] All foreignField types are `uuid` only\n\n**Quality:**\n- [ ] No duplicate fields or relations\n- [ ] No prefix duplication in table name\n- [ ] All descriptions in English\n\n**Execution:**\n- [ ] `thinking` field completed\n- [ ] Ready to call `process()` with `type: \"complete\"`" /* AutoBeSystemPromptConstant.DATABASE_SCHEMA */,
26
26
  },
27
27
  {
28
28
  id: (0, uuid_1.v7)(),
@@ -1 +1 @@
1
- {"version":3,"file":"transformPrismaSchemaReviewHistory.js","sourceRoot":"","sources":["../../../../src/orchestrate/prisma/histories/transformPrismaSchemaReviewHistory.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"transformPrismaSchemaReviewHistory.js","sourceRoot":"","sources":["../../../../src/orchestrate/prisma/histories/transformPrismaSchemaReviewHistory.ts"],"names":[],"mappings":"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"}
@@ -65,7 +65,7 @@ function orchestratePrismaCorrect(ctx, application) {
65
65
  return true;
66
66
  });
67
67
  application.files = application.files.filter((f) => f.models.length !== 0);
68
- return iterate(ctx, application, 20 /* AutoBeConfigConstant.DATABASE_CORRECT_RETRY */);
68
+ return iterate(ctx, application, 30 /* AutoBeConfigConstant.DATABASE_CORRECT_RETRY */);
69
69
  }
70
70
  function iterate(ctx, application, life) {
71
71
  return __awaiter(this, void 0, void 0, function* () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobe/agent",
3
- "version": "0.30.2",
3
+ "version": "0.30.3",
4
4
  "description": "AI backend server code generator",
5
5
  "main": "lib/index.js",
6
6
  "author": "Wrtn Technologies",
@@ -31,8 +31,8 @@
31
31
  "typia": "^12.0.1",
32
32
  "uuid": "^11.1.0",
33
33
  "yaml": "^2.8.2",
34
- "@autobe/interface": "^0.30.2",
35
- "@autobe/utils": "^0.30.2"
34
+ "@autobe/interface": "^0.30.3",
35
+ "@autobe/utils": "^0.30.3"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@rollup/plugin-json": "^6.1.0",
@@ -44,8 +44,8 @@
44
44
  "rollup": "^4.40.1",
45
45
  "ts-node": "^10.9.2",
46
46
  "typescript": "~5.9.3",
47
- "@autobe/filesystem": "^0.30.2",
48
- "@autobe/compiler": "^0.30.2"
47
+ "@autobe/filesystem": "^0.30.3",
48
+ "@autobe/compiler": "^0.30.3"
49
49
  },
50
50
  "keywords": [
51
51
  "ai",
@@ -193,8 +193,6 @@ const sleepMap: Record<AutoBeEvent.Type, number> = {
193
193
  analyzeWriteModule: 500,
194
194
  analyzeWriteUnit: 500,
195
195
  analyzeWriteSection: 500,
196
- analyzeModuleReview: 300,
197
- analyzeUnitReview: 300,
198
196
  analyzeSectionReview: 300,
199
197
  analyzeScenarioReview: 300,
200
198
  analyzeComplete: 1_000,
@@ -66,7 +66,7 @@ export const enum AutoBeConfigConstant {
66
66
  * while still providing a reasonable bound to prevent infinite correction
67
67
  * loops.
68
68
  */
69
- DATABASE_CORRECT_RETRY = 20,
69
+ DATABASE_CORRECT_RETRY = 30,
70
70
 
71
71
  /**
72
72
  * Retry attempts for LLM function-calling execution flows.