@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
@@ -42,8 +42,7 @@ export async function orchestrateInterfaceSchemaReview(
42
42
  .filter(
43
43
  ([k, v]) =>
44
44
  AutoBeJsonSchemaValidator.isPreset(k) === false &&
45
- AutoBeOpenApiTypeChecker.isObject(v) &&
46
- Object.keys(v.properties).length !== 0,
45
+ AutoBeOpenApiTypeChecker.isObject(v),
47
46
  )
48
47
  .map(([k]) => k);
49
48
  const x: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> = {};
@@ -52,6 +52,7 @@ export namespace AutoBeJsonSchemaValidator {
52
52
  validateReferenceId(props);
53
53
  validatePropertyNames(props);
54
54
  validateNumericRanges(props);
55
+ validateEmptyProperties(props);
55
56
 
56
57
  vo(props.typeName, props.schema);
57
58
  AutoBeOpenApiTypeChecker.skim({
@@ -722,4 +723,41 @@ export namespace AutoBeJsonSchemaValidator {
722
723
  },
723
724
  });
724
725
  };
726
+
727
+ const validateEmptyProperties = (props: IProps): void => {
728
+ if (AutoBeOpenApiTypeChecker.isObject(props.schema) === false) return;
729
+ if (Object.keys(props.schema.properties).length !== 0) return;
730
+ if (
731
+ isObjectType({
732
+ operations: props.operations,
733
+ typeName: props.typeName,
734
+ }) === false
735
+ )
736
+ return;
737
+
738
+ props.errors.push({
739
+ path: props.path,
740
+ expected: "At least 1 property in properties",
741
+ value: props.schema,
742
+ description: StringUtil.trim`
743
+ Schema ${JSON.stringify(props.typeName)} has zero properties but is used
744
+ as a request body or response body in API operations.
745
+
746
+ Empty properties will cause TypeScript compilation errors (TS2339) in the
747
+ downstream Realize stage because implementation code will try to access
748
+ properties that don't exist on the type.
749
+
750
+ You MUST define at least one property in the schema. Load the database
751
+ schema and add the appropriate properties based on the DTO type:
752
+ - ICreate: User-provided business fields (exclude id, timestamps, actor FKs)
753
+ - IUpdate: All mutable business fields (all optional)
754
+ - ISummary: Essential display fields for list views
755
+ - IEntity (root): All public fields including relations
756
+ - IRequest: Pagination and filter parameters
757
+ - IJoin/ILogin: Credentials and session context fields
758
+
759
+ Note that, this is not a recommendation, but an instruction you must follow.
760
+ `,
761
+ });
762
+ };
725
763
  }