@mudraforge/statutory 2.12.1 → 2.13.0

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 (116) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +13 -0
  3. package/docs/ARCHITECTURE.md +70 -47
  4. package/docs/ARCHITECTURE_DECISIONS.md +22 -2
  5. package/docs/CORPUS_QUALITY.md +3 -3
  6. package/docs/DOMAIN_BREADTH_AND_DEPTH_COMPARISON.md +4 -4
  7. package/docs/ENTERPRISE_GOVERNANCE.md +2 -1
  8. package/docs/OKF_MAINTENANCE_SOP.md +5 -5
  9. package/docs/PILOT_EVALUATION_GUIDE.md +5 -4
  10. package/docs/PROVENANCE.md +6 -6
  11. package/docs/VERIFICATION.md +6 -6
  12. package/okf/corporate_ma_restructuring/business_combinations_indas_103/ast.json +20 -0
  13. package/okf/corporate_ma_restructuring/impairment_of_assets_indas_36/ast.json +20 -0
  14. package/okf/corporate_ma_restructuring/loss_carryforward_sec79/ast.json +33 -0
  15. package/okf/corporate_ma_restructuring/share_based_payments_indas_102/ast.json +20 -0
  16. package/okf/corporate_ma_restructuring/slump_sale_50b/ast.json +21 -0
  17. package/okf/corporate_ma_restructuring/tax_clearance_sec281/ast.json +21 -0
  18. package/okf/direct_tax/corporate_tax_115baa_115jb/ast.json +23 -0
  19. package/okf/direct_tax/income_taxes_deferred_tax_indas_12/ast.json +20 -0
  20. package/okf/direct_tax/special_rates_non_filer_206ab/ast.json +26 -0
  21. package/okf/direct_tax/statutory_disallowance_43b/ast.json +35 -0
  22. package/okf/direct_tax/tcs_goods_206c_1h/ast.json +69 -0
  23. package/okf/direct_tax/tds_commission_194h/ast.json +60 -0
  24. package/okf/direct_tax/tds_contractor_194c/ast.json +71 -0
  25. package/okf/direct_tax/tds_ecommerce_194o/ast.json +48 -0
  26. package/okf/direct_tax/tds_goods_194q/ast.json +71 -0
  27. package/okf/direct_tax/tds_goods_393/ast.json +59 -0
  28. package/okf/direct_tax/tds_individual_contract_194m/ast.json +59 -0
  29. package/okf/direct_tax/tds_interest_194a/ast.json +59 -0
  30. package/okf/direct_tax/tds_perquisites_194r/ast.json +47 -0
  31. package/okf/direct_tax/tds_property_194ia/ast.json +70 -0
  32. package/okf/direct_tax/tds_rent_194i/ast.json +60 -0
  33. package/okf/direct_tax/tds_rent_individual_194ib/ast.json +59 -0
  34. package/okf/direct_tax/tds_services_194j/ast.json +60 -0
  35. package/okf/indirect_tax_gst/blocked_itc_17_5/ast.json +26 -0
  36. package/okf/indirect_tax_gst/common_itc_reversal_rule42_43/ast.json +26 -0
  37. package/okf/indirect_tax_gst/composite_mixed_supplies_sec8/ast.json +21 -0
  38. package/okf/indirect_tax_gst/composition_levy_sec10/ast.json +23 -0
  39. package/okf/indirect_tax_gst/credit_debit_notes_sec34/ast.json +21 -0
  40. package/okf/indirect_tax_gst/e_invoicing_rule48_4/ast.json +20 -0
  41. package/okf/indirect_tax_gst/export_services_lut_sec16/ast.json +20 -0
  42. package/okf/indirect_tax_gst/gst_tds_sec51/ast.json +23 -0
  43. package/okf/indirect_tax_gst/itc_eligibility_16_2/ast.json +20 -0
  44. package/okf/indirect_tax_gst/itc_reversal_rule37_37a/ast.json +45 -0
  45. package/okf/indirect_tax_gst/rcm_liability_sec9_3/ast.json +26 -0
  46. package/okf/international_tax/cross_border_remittance_195/ast.json +39 -0
  47. package/okf/international_tax/financial_instruments_ecl_indas_109/ast.json +24 -0
  48. package/okf/international_tax/foreign_exchange_indas_21_109/ast.json +20 -0
  49. package/okf/international_tax/foreign_tax_credit_irc_901_904/ast.json +20 -0
  50. package/okf/international_tax/transfer_pricing_alp_92c/ast.json +25 -0
  51. package/okf/manifest.json +49 -3
  52. package/okf/msme_commercial/delayed_payments_15_16/ast.json +38 -0
  53. package/okf/msme_commercial/enterprise_classification_sec7/ast.json +25 -0
  54. package/okf/msme_commercial/lease_accounting_indas_116/ast.json +20 -0
  55. package/okf/msme_commercial/mca_msme_1_filing/ast.json +20 -0
  56. package/okf/msme_commercial/provisions_contingencies_indas_37/ast.json +20 -0
  57. package/okf/msme_commercial/revenue_recognition_indas_115/ast.json +20 -0
  58. package/okf/msme_commercial/statutory_disclosures_sec22/ast.json +21 -0
  59. package/package.json +16 -1
  60. package/src/constants.js +1 -1
  61. package/src/index.js +16 -2
  62. package/src/payroll.js +506 -0
  63. package/src/usvm/evaluation_vm.js +504 -0
  64. package/src/usvm/index.js +65 -0
  65. package/src/usvm/math_rational.js +165 -0
  66. package/src/usvm/rules/sec_115baa_115jb_mat.json +23 -0
  67. package/src/usvm/rules/sec_192_salary_tds.json +23 -0
  68. package/src/usvm/rules/sec_194a_interest.json +59 -0
  69. package/src/usvm/rules/sec_194c_contractors.json +71 -0
  70. package/src/usvm/rules/sec_194h_commission.json +60 -0
  71. package/src/usvm/rules/sec_194i_rent.json +60 -0
  72. package/src/usvm/rules/sec_194ia_property.json +70 -0
  73. package/src/usvm/rules/sec_194ib_rent_ind.json +59 -0
  74. package/src/usvm/rules/sec_194j_services.json +60 -0
  75. package/src/usvm/rules/sec_194m_contract_ind.json +59 -0
  76. package/src/usvm/rules/sec_194o_ecommerce.json +48 -0
  77. package/src/usvm/rules/sec_194q_goods.json +71 -0
  78. package/src/usvm/rules/sec_194r_perquisites.json +47 -0
  79. package/src/usvm/rules/sec_195_cross_border.json +39 -0
  80. package/src/usvm/rules/sec_206ab_non_filer.json +26 -0
  81. package/src/usvm/rules/sec_206c1h_tcs.json +69 -0
  82. package/src/usvm/rules/sec_281_tax_clearance.json +21 -0
  83. package/src/usvm/rules/sec_393_goods.json +59 -0
  84. package/src/usvm/rules/sec_43bh_disallowance.json +35 -0
  85. package/src/usvm/rules/sec_50b_slump_sale.json +21 -0
  86. package/src/usvm/rules/sec_79_loss_continuity.json +33 -0
  87. package/src/usvm/rules/sec_92c_transfer_pricing.json +25 -0
  88. package/src/usvm/rules/sec_ftc_dtaa_relief.json +20 -0
  89. package/src/usvm/rules/sec_gst_blocked_itc_17_5.json +26 -0
  90. package/src/usvm/rules/sec_gst_composite_mixed_8.json +21 -0
  91. package/src/usvm/rules/sec_gst_composition_levy_10.json +23 -0
  92. package/src/usvm/rules/sec_gst_credit_debit_notes_34.json +21 -0
  93. package/src/usvm/rules/sec_gst_einvoicing_rule48_4.json +20 -0
  94. package/src/usvm/rules/sec_gst_ewaybill_rule138.json +21 -0
  95. package/src/usvm/rules/sec_gst_export_lut_16.json +20 -0
  96. package/src/usvm/rules/sec_gst_itc_eligibility_16_2.json +20 -0
  97. package/src/usvm/rules/sec_gst_itc_reversal_rule37_37a.json +45 -0
  98. package/src/usvm/rules/sec_gst_rcm_liability_9_3.json +26 -0
  99. package/src/usvm/rules/sec_gst_rule42_43_apportionment.json +26 -0
  100. package/src/usvm/rules/sec_gst_tds_sec51.json +23 -0
  101. package/src/usvm/rules/sec_indas102_esop.json +20 -0
  102. package/src/usvm/rules/sec_indas103_mna.json +20 -0
  103. package/src/usvm/rules/sec_indas109_ecl.json +24 -0
  104. package/src/usvm/rules/sec_indas115_revenue.json +20 -0
  105. package/src/usvm/rules/sec_indas116_leases.json +20 -0
  106. package/src/usvm/rules/sec_indas12_deferred_tax.json +20 -0
  107. package/src/usvm/rules/sec_indas21_fx_reval.json +20 -0
  108. package/src/usvm/rules/sec_indas36_impairment.json +20 -0
  109. package/src/usvm/rules/sec_indas37_provisions.json +20 -0
  110. package/src/usvm/rules/sec_msme_classification_sec7.json +25 -0
  111. package/src/usvm/rules/sec_msme_delayed_payments_15_16.json +38 -0
  112. package/src/usvm/rules/sec_msme_disclosures_sec22.json +21 -0
  113. package/src/usvm/rules/sec_msme_mca_form_1.json +20 -0
  114. package/src/usvm/schemas/statutory_ast_schema.js +203 -0
  115. package/src/usvm/usvm_domain_evaluators.js +1021 -0
  116. package/types/index.d.ts +39 -0
package/types/index.d.ts CHANGED
@@ -896,6 +896,45 @@ export interface WatchtowerReport {
896
896
 
897
897
  export declare function runStatutoryWatchtower(options?: { okfDir?: string; verbose?: boolean }): Promise<WatchtowerReport>;
898
898
 
899
+ // Universal Statutory Virtual Machine (USVM) Declarative Kernel
900
+ export interface UsvmAstRule {
901
+ sectionId: string;
902
+ sectionCode: string;
903
+ governingStatute: string;
904
+ statutorySection: string;
905
+ successorSection?: string;
906
+ mathArchetype: string;
907
+ triggerPolicy: string;
908
+ roundingPolicy: string;
909
+ rules?: any[];
910
+ [key: string]: any;
911
+ }
912
+
913
+ export interface UsvmEvaluationResult {
914
+ statuteCode: string;
915
+ governingStatute: string;
916
+ statutorySection: string;
917
+ isAuthorizedToDisburse: false;
918
+ calculatedTdsInr?: number;
919
+ calculatedTcsInr?: number;
920
+ effectiveRatePercent?: number;
921
+ taxableBaseInr?: number;
922
+ taxPayableInr?: number;
923
+ disposition?: string;
924
+ [key: string]: any;
925
+ }
926
+
927
+ export declare function evaluateStatutoryAst(ast: UsvmAstRule, facts: Record<string, any>, options?: { asOfDate?: string; trace?: boolean }): UsvmEvaluationResult;
928
+ export declare function validateStatutoryAst(ast: unknown): { valid: boolean; errors?: string[] };
929
+ export declare function toBigIntPaise(amountInr: number | string | bigint): bigint;
930
+ export declare function fromBigIntPaise(paiseBigInt: bigint): number;
931
+ export declare function getStatutoryAst(sectionKey: string): UsvmAstRule | null;
932
+ export declare class StatutoryAstValidationError extends Error {
933
+ errors: string[];
934
+ constructor(message: string, errors?: string[]);
935
+ }
936
+
937
+
899
938
 
900
939
 
901
940