@carbonstopper/agent-mcp 0.1.47 → 0.1.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/tools.js CHANGED
@@ -516,36 +516,40 @@ const enterpriseEmissionComputationUpdateSchema = z.object({
516
516
  unit: z.string().optional().describe("Total emission unit. Agent normally should omit this unless backend requires a known display unit."),
517
517
  sourceList: z.array(enterpriseEmissionSourceUpdateSchema).min(1).describe("Emission source updates under this computation. Every item must include sourceId."),
518
518
  });
519
- const cbam2Language = z.enum(["zh", "en"])
519
+ const cbamLanguage = z.enum(["zh", "en"])
520
520
  .optional()
521
- .describe("Response language for this CBAM2 call. Omit to use Chinese; supported values are zh and en.");
522
- const cbam2Code = z.union([
521
+ .describe("Response language for this CBAM call. Omit to use Chinese; supported values are zh and en.");
522
+ const cbamCode = z.union([
523
523
  z.number().int().nonnegative(),
524
524
  z.string().trim().regex(/^\d+$/, "Expected a numeric CBAM code"),
525
525
  ]);
526
- const cbam2ZeroOne = z.union([
526
+ const cbamZeroOne = z.union([
527
527
  z.literal(0),
528
528
  z.literal(1),
529
529
  z.literal("0"),
530
530
  z.literal("1"),
531
531
  ]);
532
- const cbam2Date = z.string().trim()
532
+ const cbamDate = z.string().trim()
533
533
  .regex(/^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])$/, "Expected yyyy-MM-dd")
534
534
  .describe("Calendar date in yyyy-MM-dd format.");
535
- const cbam2ReadFields = {
535
+ const cbamReadFields = {
536
536
  sessionId,
537
537
  ...skillTraceFields,
538
- lang: cbam2Language,
538
+ lang: cbamLanguage,
539
539
  };
540
- const cbam2WriteFields = {
541
- ...cbam2ReadFields,
540
+ const cbamWriteFields = {
541
+ ...cbamReadFields,
542
542
  idempotencyKey: idempotencyKey.max(128),
543
543
  };
544
- const cbam2ConfirmedWriteFields = {
545
- ...cbam2WriteFields,
546
- ...confirmedActionFields,
544
+ const cbamApprovalFields = {
545
+ confirmed: z.boolean().optional()
546
+ .describe("Trusted Agent wrapper approval flag. For high-risk actions the wrapper must inject true only after the existing LangGraph approval interrupt is approved."),
547
547
  };
548
- const cbam2ReferenceType = z.enum([
548
+ const cbamConfirmedWriteFields = {
549
+ ...cbamWriteFields,
550
+ ...cbamApprovalFields,
551
+ };
552
+ const cbamReferenceType = z.enum([
549
553
  "ORGANIZATION",
550
554
  "FACTORY",
551
555
  "COUNTRY",
@@ -559,7 +563,7 @@ const cbam2ReferenceType = z.enum([
559
563
  "DEFAULT_SALE",
560
564
  "CARBON_TAX_CANDIDATE",
561
565
  ]);
562
- const cbam2Section = z.enum([
566
+ const cbamSection = z.enum([
563
567
  "GENERAL_INFO",
564
568
  "PROCESS",
565
569
  "PRECURSOR",
@@ -572,7 +576,7 @@ const cbam2Section = z.enum([
572
576
  "DATA_QUALITY",
573
577
  "RESULT_SUMMARY",
574
578
  ]);
575
- const cbam2ItemType = z.enum([
579
+ const cbamItemType = z.enum([
576
580
  "PROCESS",
577
581
  "PRECURSOR",
578
582
  "SOURCE_FLOW",
@@ -581,30 +585,30 @@ const cbam2ItemType = z.enum([
581
585
  "CARBON_TAX",
582
586
  "DATA_QUALITY",
583
587
  ]);
584
- function cbam2Coordinate(minimum, maximum, name) {
588
+ function cbamCoordinate(minimum, maximum, name) {
585
589
  return z.string().trim().min(1).max(50)
586
590
  .refine((value) => Number.isFinite(Number(value)), `${name} must be a decimal number`)
587
591
  .refine((value) => Number(value) >= minimum && Number(value) <= maximum, `${name} must be between ${minimum} and ${maximum}`);
588
592
  }
589
- const cbam2FactoryForm = z.object({
593
+ const cbamFactoryForm = z.object({
590
594
  factorName: z.string().trim().min(1).max(100).describe("Factory Chinese or local name."),
591
- orgId: longId.describe("Organization id returned by cbam2_reference_search with type ORGANIZATION."),
595
+ orgId: longId.describe("Organization id returned by cbam_reference_search with type ORGANIZATION."),
592
596
  factoryCode: z.string().max(100).optional().describe("Optional globally unique factory code. Omit it on create to let the backend generate one; preserve the returned value on update."),
593
597
  factoryNameEn: z.string().trim().min(1).max(200).describe("Factory English name."),
594
- country: z.string().trim().min(1).max(100).describe("Country dictionary value returned by cbam2_reference_search with type COUNTRY."),
598
+ country: z.string().trim().min(1).max(100).describe("Country dictionary value returned by cbam_reference_search with type COUNTRY."),
595
599
  locationCode: z.string().trim().min(1).max(100).describe("UN/LOCODE or supported location code."),
596
600
  city: z.string().trim().min(1).max(100),
597
601
  detailedAddress: z.string().trim().min(1).max(500),
598
602
  postalCode: z.string().trim().min(1).max(30),
599
603
  postOfficeBox: z.string().trim().min(1).max(100),
600
- longitude: cbam2Coordinate(-180, 180, "longitude"),
601
- latitude: cbam2Coordinate(-90, 90, "latitude"),
604
+ longitude: cbamCoordinate(-180, 180, "longitude"),
605
+ latitude: cbamCoordinate(-90, 90, "latitude"),
602
606
  economicActivity: z.string().max(1000).optional(),
603
607
  authorizedRepresentative: z.string().max(100).optional(),
604
608
  email: z.union([z.string().email().max(100), z.literal("")]).optional(),
605
609
  mobile: z.string().max(50).optional(),
606
610
  });
607
- const cbam2Verification = z.object({
611
+ const cbamVerification = z.object({
608
612
  corporateName: z.string().max(200).optional(),
609
613
  detailedAddress: z.string().max(500).optional(),
610
614
  city: z.string().max(100).optional(),
@@ -618,39 +622,39 @@ const cbam2Verification = z.object({
618
622
  certificationName: z.string().max(200).optional(),
619
623
  registrationNo: z.string().max(100).optional(),
620
624
  });
621
- const cbam2ReportForm = z.object({
625
+ const cbamReportForm = z.object({
622
626
  reportName: z.string().trim().min(1).max(200),
623
627
  orgId: longId.describe("Organization id for the report. It must be visible to the current user."),
624
- startDate: cbam2Date,
625
- endDate: cbam2Date,
626
- factoryId: longId.describe("Factory id returned by cbam2_reference_search or cbam2_factory_save."),
627
- include: cbam2ZeroOne.describe("Heat-power cogeneration flag. 0=include heat-power data; 1=do not include it, matching the migrated CBAM2 convention."),
628
- verification: cbam2Verification.optional().describe("Optional verification organization information. Omit on update to preserve the current verification record."),
628
+ startDate: cbamDate,
629
+ endDate: cbamDate,
630
+ factoryId: longId.describe("Factory id returned by cbam_reference_search or cbam_factory_save."),
631
+ include: cbamZeroOne.describe("Heat-power cogeneration flag. 0=include heat-power data; 1=do not include it, matching the migrated CBAM convention."),
632
+ verification: cbamVerification.optional().describe("Optional verification organization information. Omit on update to preserve the current verification record."),
629
633
  });
630
- const cbam2ProcessDefinition = z.object({
634
+ const cbamProcessDefinition = z.object({
631
635
  id: longId.optional().describe("Existing process id for update. Omit to create a new process."),
632
636
  processName: z.string().trim().min(1).max(200),
633
- productCategoryId: longId.describe("Product category id returned by cbam2_reference_search."),
637
+ productCategoryId: longId.describe("Product category id returned by cbam_reference_search."),
634
638
  preId: z.string().optional().describe("Comma-separated preceding process ids from this report. Use an empty string to clear."),
635
639
  elseProduct: z.string().optional().describe("Comma-separated default-product ids for the selected category. Use an empty string to clear."),
636
640
  preProcess: z.string().optional().describe("Comma-separated precursor ids from this report. Use an empty string to clear."),
637
641
  orderNum: z.number().int().min(1).max(10).optional(),
638
- productRoute: z.string().optional().describe("Comma-separated default-process route ids returned by cbam2_reference_search."),
639
- includeType: cbam2ZeroOne.optional().describe("Production-route selection mode: 0=automatic, 1=manual."),
642
+ productRoute: z.string().optional().describe("Comma-separated default-process route ids returned by cbam_reference_search."),
643
+ includeType: cbamZeroOne.optional().describe("Production-route selection mode: 0=automatic, 1=manual."),
640
644
  });
641
- const cbam2PrecursorDefinition = z.object({
645
+ const cbamPrecursorDefinition = z.object({
642
646
  id: longId.optional().describe("Existing precursor id for update. Omit to create a new precursor."),
643
647
  preName: z.string().trim().min(1).max(200),
644
- productCategoryId: longId.describe("Product category id returned by cbam2_reference_search."),
645
- countryCode: z.string().max(100).optional().describe("Country dictionary value returned by cbam2_reference_search; omit or clear when not yet known."),
648
+ productCategoryId: longId.describe("Product category id returned by cbam_reference_search."),
649
+ countryCode: z.string().max(100).optional().describe("Country dictionary value returned by cbam_reference_search; omit or clear when not yet known."),
646
650
  orderNum: z.number().int().min(1).max(20).optional(),
647
- productRoute: z.string().optional().describe("Comma-separated default-process route ids returned by cbam2_reference_search."),
651
+ productRoute: z.string().optional().describe("Comma-separated default-process route ids returned by cbam_reference_search."),
648
652
  });
649
- const cbam2SourceFlow = z.object({
653
+ const cbamSourceFlow = z.object({
650
654
  id: longId.optional().describe("Existing source-flow id for update. Omit to create a new row."),
651
655
  productProcessId: longId.describe("Owning process id from the same report."),
652
- processMethod: cbam2Code.describe("Process-method code returned by CBAM_ENUM reference data."),
653
- sourceType: cbam2Code.describe("Source-flow type code returned by CBAM_ENUM reference data."),
656
+ processMethod: cbamCode.describe("Process-method code returned by CBAM_ENUM reference data."),
657
+ sourceType: cbamCode.describe("Source-flow type code returned by CBAM_ENUM reference data."),
654
658
  sourceName: z.string().trim().min(1).max(200),
655
659
  activityData: nonNegativeNumericValue.optional().describe("Activity amount. Required for sourceType=1 with processMethod 1/2/3 and for sourceType=2 with processMethod 4/5."),
656
660
  activityUnit: z.string().max(100).optional().describe("Unit of activityData."),
@@ -660,7 +664,7 @@ const cbam2SourceFlow = z.object({
660
664
  emissionCoefficientUnit: z.string().max(100).optional().describe("Emission-coefficient unit. For sourceType=1, value tCO2/TJ additionally requires lowHeat."),
661
665
  conversionRate: nonNegativeNumericValue.optional().describe("Conversion factor for sourceType=1/processMethod=2; slope coefficient for sourceType=2/processMethod=4; average flue-gas flow for sourceType=3."),
662
666
  oxRate: nonNegativeNumericValue.optional().describe("Oxidation rate for sourceType=1/processMethod=1; C2F6 fraction for sourceType=2/processMethod=4/5."),
663
- carbon: nonNegativeNumericValue.optional().describe("Carbon content for sourceType=1/processMethod=3; PFC collection efficiency for sourceType=2. It is required and must be greater than zero for sourceType=2/processMethod=5. The backend defaults it only where the CBAM2 formula allows."),
667
+ carbon: nonNegativeNumericValue.optional().describe("Carbon content for sourceType=1/processMethod=3; PFC collection efficiency for sourceType=2. It is required and must be greater than zero for sourceType=2/processMethod=5. The backend defaults it only where the CBAM formula allows."),
664
668
  carbonUnit: z.string().max(100).optional(),
665
669
  conversionRateUnit: z.string().max(100).optional(),
666
670
  biomassContent: nonNegativeNumericValue.optional().describe("Biomass content for sourceType=1; anode-effect overvoltage AEO for sourceType=2/processMethod=5; biomass share for sourceType=3."),
@@ -668,7 +672,7 @@ const cbam2SourceFlow = z.object({
668
672
  carbonFossil: nonNegativeNumericValue.optional().describe("Non-zero anode-effect CE denominator, required only for sourceType=2/processMethod=5."),
669
673
  carbonBiological: nonNegativeNumericValue.optional().describe("Overvoltage coefficient, required only for sourceType=2/processMethod=5."),
670
674
  }).describe("Editable source-flow inputs. Valid combinations are sourceType=1 with processMethod=1/2/3, sourceType=2 with processMethod=4/5, or sourceType=3 with processMethod=6/7. energyFossil and attachments are backend-owned and are never accepted.");
671
- const cbam2HeatPowerData = z.object({
675
+ const cbamHeatPowerData = z.object({
672
676
  fuelIn: positiveNumericValue.describe("Fuel input; must be greater than zero."),
673
677
  hotPer: positiveNumericValue.describe("Heat allocation parameter; must be greater than zero."),
674
678
  elePer: positiveNumericValue.describe("Electricity allocation parameter; must be greater than zero."),
@@ -678,54 +682,54 @@ const cbam2HeatPowerData = z.object({
678
682
  smokeOut: nonNegativeNumericValue,
679
683
  inputFactor: nonNegativeNumericValue.optional(),
680
684
  });
681
- const cbam2ActivityRow = z.object({
685
+ const cbamActivityRow = z.object({
682
686
  relationId: longId.describe("Default-process id or related process id selected from the current item route."),
683
- isDefault: cbam2ZeroOne.describe("0=default-process route row; 1=related in-report process row."),
687
+ isDefault: cbamZeroOne.describe("0=default-process route row; 1=related in-report process row."),
684
688
  emission: nonNegativeNumericValue.describe("Activity amount for this route row."),
685
689
  });
686
- const cbam2ProductAttribution = z.object({
687
- id: longId.optional().describe("Existing attribution id returned by cbam2_report_read. Omit for a new row."),
688
- emissionElement: cbam2Code.describe("Emission-element code returned by CBAM_ENUM reference data."),
689
- isExists: cbam2Code.describe("Whether this emission element is included; use the exact CBAM_ENUM code."),
690
+ const cbamProductAttribution = z.object({
691
+ id: longId.optional().describe("Existing attribution id returned by cbam_report_read. Omit for a new row."),
692
+ emissionElement: cbamCode.describe("Emission-element code returned by CBAM_ENUM reference data."),
693
+ isExists: cbamCode.describe("Whether this emission element is included; use the exact CBAM_ENUM code."),
690
694
  inputPower: nonNegativeNumericValue.optional(),
691
695
  inputFactor: nonNegativeNumericValue.optional(),
692
696
  outPower: nonNegativeNumericValue.optional(),
693
697
  outFactor: nonNegativeNumericValue.optional(),
694
- emissionSource: cbam2Code.optional(),
698
+ emissionSource: cbamCode.optional(),
695
699
  eleSource: z.string().max(100).optional(),
696
- eleChoose: cbam2Code.optional(),
700
+ eleChoose: cbamCode.optional(),
697
701
  defaultCnId: longId.optional(),
698
702
  cnCode: z.string().max(100).optional(),
699
703
  });
700
- const cbam2ElectricityCalculator = z.object({
704
+ const cbamElectricityCalculator = z.object({
701
705
  id: longId.optional(),
702
706
  eleValue: nonNegativeNumericValue,
703
707
  coefficient: nonNegativeNumericValue,
704
708
  });
705
- const cbam2ProcessProductData = z.object({
709
+ const cbamProcessProductData = z.object({
706
710
  id: longId.describe("Existing process id from the same report."),
707
711
  totalVolume: nonNegativeNumericValue.describe("Total output. Must satisfy totalVolume - salesVolume - nonProduct - sum(processList emission where isDefault=1) = 0 at six-decimal precision."),
708
712
  salesVolume: nonNegativeNumericValue.describe("Sold output used in the process balance equation."),
709
713
  nonProduct: nonNegativeNumericValue.optional().describe("Non-product output used in the process balance equation; omit to treat it as zero."),
710
- processList: z.array(cbam2ActivityRow).max(100).optional().describe("Activity route rows. Rows with isDefault=1 are subtracted in the process balance equation."),
711
- productAttributionList: z.array(cbam2ProductAttribution).max(100).optional(),
712
- eleCalculatorList: z.array(cbam2ElectricityCalculator).max(100).optional(),
714
+ processList: z.array(cbamActivityRow).max(100).optional().describe("Activity route rows. Rows with isDefault=1 are subtracted in the process balance equation."),
715
+ productAttributionList: z.array(cbamProductAttribution).max(100).optional(),
716
+ eleCalculatorList: z.array(cbamElectricityCalculator).max(100).optional(),
713
717
  }).describe("Complete product activity/emission data for one existing process. The backend rejects an unbalanced item.");
714
- const cbam2PrecursorProductData = z.object({
718
+ const cbamPrecursorProductData = z.object({
715
719
  id: longId.describe("Existing precursor id from the same report."),
716
720
  purchaseVolume: nonNegativeNumericValue.optional(),
717
721
  nonProduct: nonNegativeNumericValue.optional().describe("Non-product amount subtracted in the precursor balance equation."),
718
- defaultReason: cbam2Code.optional(),
719
- isDefault: cbam2ZeroOne.optional(),
720
- processList: z.array(cbam2ActivityRow).max(100).optional().describe("Must satisfy sum(emission where isDefault=0) - sum(emission where isDefault=1) - nonProduct = 0 at six-decimal precision."),
721
- productAttributionList: z.array(cbam2ProductAttribution).max(100).optional(),
722
+ defaultReason: cbamCode.optional(),
723
+ isDefault: cbamZeroOne.optional(),
724
+ processList: z.array(cbamActivityRow).max(100).optional().describe("Must satisfy sum(emission where isDefault=0) - sum(emission where isDefault=1) - nonProduct = 0 at six-decimal precision."),
725
+ productAttributionList: z.array(cbamProductAttribution).max(100).optional(),
722
726
  }).describe("Complete activity/emission data for one existing precursor. The backend rejects an unbalanced item.");
723
- const cbam2SaleProduct = z.object({
727
+ const cbamSaleProduct = z.object({
724
728
  id: longId.optional().describe("Existing sale-product id for update. Omit to create."),
725
729
  cnCode: z.string().trim().min(1).max(100).describe("CN code valid for the selected process product category."),
726
730
  processId: longId.describe("Owning process id from the same report."),
727
731
  productName: z.string().trim().min(1).max(200),
728
- reducing: cbam2Code.optional(),
732
+ reducing: cbamCode.optional(),
729
733
  steelCode: z.string().max(100).optional(),
730
734
  mnPer: nonNegativeNumericValue.optional(),
731
735
  crPer: nonNegativeNumericValue.optional(),
@@ -737,9 +741,9 @@ const cbam2SaleProduct = z.object({
737
741
  wasteMaterial: nonNegativeNumericValue.optional(),
738
742
  alUse: nonNegativeNumericValue.optional(),
739
743
  nonAl: nonNegativeNumericValue.optional(),
740
- clinker: nonNegativeNumericValue.describe("Cement clinker value required by the migrated CBAM2 form contract."),
741
- calcine: cbam2Code.describe("Calcination flag code required by the migrated CBAM2 form contract."),
742
- solution: nonNegativeNumericValue.describe("Aqueous-solution concentration required by the migrated CBAM2 form contract."),
744
+ clinker: nonNegativeNumericValue.describe("Cement clinker value required by the migrated CBAM form contract."),
745
+ calcine: cbamCode.describe("Calcination flag code required by the migrated CBAM form contract."),
746
+ solution: nonNegativeNumericValue.describe("Aqueous-solution concentration required by the migrated CBAM form contract."),
743
747
  nitric: nonNegativeNumericValue.optional(),
744
748
  urea: nonNegativeNumericValue.optional(),
745
749
  nitrogen: nonNegativeNumericValue.optional(),
@@ -748,31 +752,31 @@ const cbam2SaleProduct = z.object({
748
752
  urPer: nonNegativeNumericValue.optional(),
749
753
  organic: nonNegativeNumericValue.optional(),
750
754
  });
751
- const cbam2CarbonTax = z.object({
755
+ const cbamCarbonTax = z.object({
752
756
  id: longId.optional().describe("Existing carbon-tax row id for update. Omit to create."),
753
757
  saleProductId: longId.describe("Sale-product id from the same report."),
754
- reportSelected: cbam2ZeroOne.optional(),
755
- emissionValueType: cbam2Code.optional(),
756
- emissionSourceType: cbam2Code.optional(),
758
+ reportSelected: cbamZeroOne.optional(),
759
+ emissionValueType: cbamCode.optional(),
760
+ emissionSourceType: cbamCode.optional(),
757
761
  emissionSourceSaleProductId: longId.optional(),
758
762
  emissionSourceDefaultCnId: longId.optional(),
759
763
  emissionSourceYear: z.number().int().min(1900).max(9999).optional(),
760
764
  productBenchmarkId: longId.optional(),
761
- productBenchmarkType: cbam2Code.optional(),
765
+ productBenchmarkType: cbamCode.optional(),
762
766
  cbamAdjustmentFactor: nonNegativeNumericValue.optional(),
763
767
  paidCarbonPrice: nonNegativeNumericValue.optional(),
764
- taxType: cbam2Code.optional(),
768
+ taxType: cbamCode.optional(),
765
769
  emissionPer: nonNegativeNumericValue.optional(),
766
- currencyType: z.string().trim().min(1).max(100).describe("Currency dictionary value returned by cbam2_reference_search."),
770
+ currencyType: z.string().trim().min(1).max(100).describe("Currency dictionary value returned by cbam_reference_search."),
767
771
  taxValue: nonNegativeNumericValue.optional(),
768
- offsetMethod: cbam2Code.optional(),
772
+ offsetMethod: cbamCode.optional(),
769
773
  offsetPer: nonNegativeNumericValue.optional(),
770
774
  offsetPrice: nonNegativeNumericValue.optional(),
771
775
  });
772
- const cbam2DataQuality = z.object({
773
- generalInformation: cbam2Code.optional(),
774
- defaultReason: cbam2Code.optional(),
775
- qualityAssurance: cbam2Code.optional(),
776
+ const cbamDataQuality = z.object({
777
+ generalInformation: cbamCode.optional(),
778
+ defaultReason: cbamCode.optional(),
779
+ qualityAssurance: cbamCode.optional(),
776
780
  carbonPrice: z.string().max(5000).optional(),
777
781
  supplement: z.string().max(5000).optional(),
778
782
  });
@@ -780,13 +784,13 @@ export const schemas = {
780
784
  session_carbon_objects: z.object({
781
785
  sessionId,
782
786
  module: z
783
- .enum(["all", "footprint3", "enterprise", "cbam2"])
787
+ .enum(["all", "footprint3", "enterprise", "cbam"])
784
788
  .optional()
785
- .describe("Optional module filter. Omit it or use all to return product-carbon, enterprise-carbon, and CBAM2 objects."),
789
+ .describe("Optional module filter. Omit it or use all to return product-carbon, enterprise-carbon, and CBAM objects."),
786
790
  }),
787
- cbam2_reference_search: z.object({
788
- ...cbam2ReadFields,
789
- types: z.array(cbam2ReferenceType).min(1).max(12)
791
+ cbam_reference_search: z.object({
792
+ ...cbamReadFields,
793
+ types: z.array(cbamReferenceType).min(1).max(12)
790
794
  .describe("Only the reference-data families needed for the current step. CARBON_TAX_CANDIDATE additionally requires reportId."),
791
795
  keyword: z.string().trim().max(200).optional(),
792
796
  orgId: longId.optional(),
@@ -795,8 +799,8 @@ export const schemas = {
795
799
  pageNum: z.number().int().min(1).optional(),
796
800
  pageSize: z.number().int().min(1).max(200).optional(),
797
801
  }),
798
- cbam2_report_search: z.object({
799
- ...cbam2ReadFields,
802
+ cbam_report_search: z.object({
803
+ ...cbamReadFields,
800
804
  reportName: z.string().trim().max(200).optional(),
801
805
  orgId: longId.optional(),
802
806
  factoryId: longId.optional(),
@@ -804,94 +808,94 @@ export const schemas = {
804
808
  pageNum: z.number().int().min(1).optional(),
805
809
  pageSize: z.number().int().min(1).max(100).optional(),
806
810
  }),
807
- cbam2_report_read: z.object({
808
- ...cbam2ReadFields,
809
- reportId: longId.describe("Exact CBAM2 report id returned by cbam2_report_search, cbam2_report_save, or session_carbon_objects."),
811
+ cbam_report_read: z.object({
812
+ ...cbamReadFields,
813
+ reportId: longId.describe("Exact CBAM report id returned by cbam_report_search, cbam_report_save, or session_carbon_objects."),
810
814
  view: z.enum(["snapshot", "section", "item", "result", "readiness", "carbon_tax_status"])
811
815
  .describe("Read mode. snapshot=whole workflow overview; section=one form section; item=one child record; result=result summary; readiness=generation blockers; carbon_tax_status=asynchronous tax calculation status."),
812
- section: cbam2Section.optional().describe("Required only when view=section."),
813
- itemType: cbam2ItemType.optional().describe("Required only when view=item."),
816
+ section: cbamSection.optional().describe("Required only when view=section."),
817
+ itemType: cbamItemType.optional().describe("Required only when view=item."),
814
818
  itemId: longId.optional().describe("Required only when view=item; must belong to reportId."),
815
819
  }),
816
- cbam2_factory_read: z.object({
817
- ...cbam2ReadFields,
818
- factoryId: longId.describe("Exact factory id returned by cbam2_reference_search or cbam2_factory_save."),
820
+ cbam_factory_read: z.object({
821
+ ...cbamReadFields,
822
+ factoryId: longId.describe("Exact factory id returned by cbam_reference_search or cbam_factory_save."),
819
823
  }),
820
- cbam2_factory_save: z.object({
821
- ...cbam2ConfirmedWriteFields,
824
+ cbam_factory_save: z.object({
825
+ ...cbamConfirmedWriteFields,
822
826
  action: z.enum(["create", "update"]),
823
827
  factoryId: longId.optional().describe("Required for action=update and omitted for action=create."),
824
- factory: cbam2FactoryForm.describe("Complete factory form. For update, first call cbam2_factory_read and preserve unchanged fields and orgId."),
828
+ factory: cbamFactoryForm.describe("Complete factory form. For update, first call cbam_factory_read and preserve unchanged fields and orgId."),
825
829
  }),
826
- cbam2_report_save: z.object({
827
- ...cbam2WriteFields,
830
+ cbam_report_save: z.object({
831
+ ...cbamWriteFields,
828
832
  action: z.enum(["create", "update"]),
829
833
  reportId: longId.optional().describe("Required for action=update and omitted for action=create."),
830
- report: cbam2ReportForm.describe("Complete CBAM2 general-information form."),
834
+ report: cbamReportForm.describe("Complete CBAM general-information form."),
831
835
  }),
832
- cbam2_process_manage: z.object({
833
- ...cbam2ConfirmedWriteFields,
836
+ cbam_process_manage: z.object({
837
+ ...cbamConfirmedWriteFields,
834
838
  reportId: longId,
835
- action: z.enum(["save", "delete", "reorder"]).describe("save requires items and forbids ids; delete requires ids and uses WAIT_CONFIRM; reorder requires the complete ordered ids list and forbids items."),
836
- items: z.array(cbam2ProcessDefinition).min(1).max(10).optional()
839
+ action: z.enum(["save", "delete", "reorder"]).describe("save requires items and forbids ids; delete requires prior Agent approval and confirmed=true; reorder requires the complete ordered ids list and forbids items."),
840
+ items: z.array(cbamProcessDefinition).min(1).max(10).optional()
837
841
  .describe("Required only for action=save. The report can contain at most 10 processes."),
838
842
  ids: z.array(longId).min(1).max(10).optional()
839
843
  .describe("Required for delete/reorder. Reorder must contain every report process exactly once in target order."),
840
844
  }),
841
- cbam2_precursor_manage: z.object({
842
- ...cbam2ConfirmedWriteFields,
845
+ cbam_precursor_manage: z.object({
846
+ ...cbamConfirmedWriteFields,
843
847
  reportId: longId,
844
- action: z.enum(["save", "delete"]).describe("save requires items and forbids ids; delete requires ids and uses WAIT_CONFIRM."),
845
- items: z.array(cbam2PrecursorDefinition).min(1).max(20).optional()
848
+ action: z.enum(["save", "delete"]).describe("save requires items and forbids ids; delete requires ids plus prior Agent approval and confirmed=true."),
849
+ items: z.array(cbamPrecursorDefinition).min(1).max(20).optional()
846
850
  .describe("Required only for action=save. The report can contain at most 20 manually entered precursors."),
847
851
  ids: z.array(longId).min(1).max(20).optional().describe("Required only for action=delete."),
848
852
  }),
849
- cbam2_source_flow_manage: z.object({
850
- ...cbam2ConfirmedWriteFields,
853
+ cbam_source_flow_manage: z.object({
854
+ ...cbamConfirmedWriteFields,
851
855
  reportId: longId,
852
- action: z.enum(["save", "delete"]).describe("save requires items and forbids ids; delete requires ids and uses WAIT_CONFIRM."),
853
- items: z.array(cbam2SourceFlow).min(1).max(200).optional().describe("Required only for action=save."),
856
+ action: z.enum(["save", "delete"]).describe("save requires items and forbids ids; delete requires ids plus prior Agent approval and confirmed=true."),
857
+ items: z.array(cbamSourceFlow).min(1).max(200).optional().describe("Required only for action=save."),
854
858
  ids: z.array(longId).min(1).max(100).optional().describe("Required only for action=delete."),
855
859
  }),
856
- cbam2_heat_power_update: z.object({
857
- ...cbam2WriteFields,
860
+ cbam_heat_power_update: z.object({
861
+ ...cbamWriteFields,
858
862
  reportId: longId,
859
- data: cbam2HeatPowerData.describe("Complete heat-power input form. The backend calculates outPower and outFactor; never submit calculated outputs."),
863
+ data: cbamHeatPowerData.describe("Complete heat-power input form. The backend calculates outPower and outFactor; never submit calculated outputs."),
860
864
  }),
861
- cbam2_product_data_update: z.object({
862
- ...cbam2WriteFields,
865
+ cbam_product_data_update: z.object({
866
+ ...cbamWriteFields,
863
867
  reportId: longId,
864
868
  dataType: z.enum(["process", "precursor"])
865
869
  .describe("Select process for self-produced process activity data or precursor for purchased-precursor activity/emission data."),
866
- items: z.array(z.union([cbam2ProcessProductData, cbam2PrecursorProductData])).min(1).max(100),
870
+ items: z.array(z.union([cbamProcessProductData, cbamPrecursorProductData])).min(1).max(100),
867
871
  }),
868
- cbam2_sale_product_manage: z.object({
869
- ...cbam2ConfirmedWriteFields,
872
+ cbam_sale_product_manage: z.object({
873
+ ...cbamConfirmedWriteFields,
870
874
  reportId: longId,
871
- action: z.enum(["save", "delete"]).describe("save requires items and forbids ids; delete requires ids and uses WAIT_CONFIRM."),
872
- items: z.array(cbam2SaleProduct).min(1).max(100).optional().describe("Required only for action=save."),
875
+ action: z.enum(["save", "delete"]).describe("save requires items and forbids ids; delete requires ids plus prior Agent approval and confirmed=true."),
876
+ items: z.array(cbamSaleProduct).min(1).max(100).optional().describe("Required only for action=save."),
873
877
  ids: z.array(longId).min(1).max(100).optional().describe("Required only for action=delete."),
874
878
  }),
875
- cbam2_carbon_tax_manage: z.object({
876
- ...cbam2ConfirmedWriteFields,
879
+ cbam_carbon_tax_manage: z.object({
880
+ ...cbamConfirmedWriteFields,
877
881
  reportId: longId,
878
- action: z.enum(["save", "delete", "calculate"]).describe("save requires items; delete requires ids and WAIT_CONFIRM; calculate forbids items/ids and uses WAIT_CONFIRM."),
879
- items: z.array(cbam2CarbonTax).min(1).max(100).optional().describe("Required only for action=save."),
882
+ action: z.enum(["save", "delete", "calculate"]).describe("save requires items; delete requires ids; calculate forbids items/ids. delete/calculate require prior Agent approval and confirmed=true."),
883
+ items: z.array(cbamCarbonTax).min(1).max(100).optional().describe("Required only for action=save."),
880
884
  ids: z.array(longId).min(1).max(100).optional().describe("Required only for action=delete."),
881
885
  }),
882
- cbam2_data_quality_update: z.object({
883
- ...cbam2WriteFields,
886
+ cbam_data_quality_update: z.object({
887
+ ...cbamWriteFields,
884
888
  reportId: longId,
885
- data: cbam2DataQuality.describe("Complete data-quality form. Read DATA_QUALITY first and preserve fields the user did not change."),
889
+ data: cbamDataQuality.describe("Complete data-quality form. Read DATA_QUALITY first and preserve fields the user did not change."),
886
890
  }),
887
- cbam2_report_generate: z.object({
888
- ...cbam2ConfirmedWriteFields,
889
- reportId: longId.describe("CBAM2 report id to generate. Basic general information is sufficient to start; readiness reports optional missing sections separately."),
891
+ cbam_report_generate: z.object({
892
+ ...cbamConfirmedWriteFields,
893
+ reportId: longId.describe("CBAM report id to generate. Basic general information is sufficient to start; readiness reports optional missing sections separately."),
890
894
  }),
891
- cbam2_report_generation_status: z.object({
892
- ...cbam2ReadFields,
895
+ cbam_report_generation_status: z.object({
896
+ ...cbamReadFields,
893
897
  reportId: longId,
894
- generationId: longId.describe("Generation task id returned by cbam2_report_generate."),
898
+ generationId: longId.describe("Generation task id returned by cbam_report_generate."),
895
899
  }),
896
900
  user_memory_recall: z.object({
897
901
  sessionId,
@@ -1344,22 +1348,21 @@ export const schemas = {
1344
1348
  schemas.enterprise_report_regenerate = schemas.enterprise_report_generate;
1345
1349
  export const exposedToolNames = [
1346
1350
  "session_carbon_objects",
1347
- "cbam2_reference_search",
1348
- "cbam2_report_search",
1349
- "cbam2_report_read",
1350
- "cbam2_factory_read",
1351
- "cbam2_factory_save",
1352
- "cbam2_report_save",
1353
- "cbam2_process_manage",
1354
- "cbam2_precursor_manage",
1355
- "cbam2_source_flow_manage",
1356
- "cbam2_heat_power_update",
1357
- "cbam2_product_data_update",
1358
- "cbam2_sale_product_manage",
1359
- "cbam2_carbon_tax_manage",
1360
- "cbam2_data_quality_update",
1361
- "cbam2_report_generate",
1362
- "cbam2_report_generation_status",
1351
+ "cbam_reference_search",
1352
+ "cbam_report_search",
1353
+ "cbam_report_read",
1354
+ "cbam_factory_read",
1355
+ "cbam_factory_save",
1356
+ "cbam_report_save",
1357
+ "cbam_process_manage",
1358
+ "cbam_precursor_manage",
1359
+ "cbam_source_flow_manage",
1360
+ "cbam_heat_power_update",
1361
+ "cbam_product_data_update",
1362
+ "cbam_sale_product_manage",
1363
+ "cbam_carbon_tax_manage",
1364
+ "cbam_data_quality_update",
1365
+ "cbam_report_generate",
1363
1366
  "user_memory_recall",
1364
1367
  "user_memory_get",
1365
1368
  "user_memory_upsert",
@@ -1416,23 +1419,23 @@ export const exposedToolNames = [
1416
1419
  "enterprise_emission_batch_delete",
1417
1420
  ];
1418
1421
  export const descriptions = {
1419
- session_carbon_objects: "Recover product-carbon accounts, enterprise-carbon computations, and CBAM2 reports bound to the current Agent session. Call this before guessing a lost business id. Omit module or use all for every family; module=footprint3 returns productCarbonAccounts, module=enterprise returns enterpriseCarbonComputations, and module=cbam2 returns cbam2Reports. One session may contain multiple CBAM2 reports, so match by reportName/org/factory and then pass the exact cbam2Reports[].reportId to every report-specific tool. Never substitute an enterprise year, product accountId, or another report id. This tool is read-only and requires sessionId.",
1420
- cbam2_reference_search: "Read CBAM2 reference data needed for the current step: accessible organizations and factories, countries, currencies, enum codes, product categories, default processes/precursors/products/CN/sale data, or report-scoped carbon-tax candidates. Request only needed types. Use returned ids/codes exactly and never invent dictionary or organization values. CARBON_TAX_CANDIDATE requires reportId. Large reference tables are paginated with pageNum/pageSize. Read-only.",
1421
- cbam2_report_search: "Search CBAM2 reports accessible to the current user by optional name, organization, factory, year, and pagination. Use this or session_carbon_objects to resolve an exact reportId. A single Agent session can create and work with multiple CBAM2 reports; never silently select the first result when several reports match. Read-only.",
1422
- cbam2_report_read: "Unified read-only CBAM2 report inspection. view=snapshot returns workflow overview/counts/readiness; section returns one complete editable section and requires section; item reads one child record and requires itemType+itemId; result returns result analysis; readiness returns generation blockers/warnings; carbon_tax_status returns asynchronous carbon-tax calculation state. itemId must belong to reportId. Call the corresponding read view before a full-form update so unchanged fields are preserved.",
1423
- cbam2_factory_read: "Read the complete accessible CBAM2 factory form by exact factoryId. Call before updating a shared factory because factory updates are full-form writes and orgId is immutable. Read-only.",
1424
- cbam2_factory_save: "Create or fully update a shared CBAM2 factory. action=create omits factoryId; action=update requires factoryId and must follow cbam2_factory_read, preserving unchanged fields and orgId. Country and orgId must come from cbam2_reference_search. Both actions are shared-data mutations and use the backend WAIT_CONFIRM two-step flow: first call without confirmed, then repeat the identical payload/idempotencyKey with confirmed=true and the returned pendingActionId after user confirmation. MCP never automatically retries this write.",
1425
- cbam2_report_save: "Create or fully update CBAM2 report general information. action=create omits reportId; every create call creates a NEW report and binds it to the same Agent session without replacing earlier CBAM2 reports. One session may therefore contain multiple reports. action=update requires an explicit reportId and should follow cbam2_report_read view=section section=GENERAL_INFO. After more than one report exists, always pass the intended reportId to subsequent tools and ask the user when context is ambiguous. Basic general information is enough to create a report and later generate it; other sections are progressive supplements. Requires idempotencyKey.",
1426
- cbam2_process_manage: "Manage self-produced CBAM2 process definitions for one report. action=save batch-creates/updates complete definition rows; action=delete removes exact ids; action=reorder requires every current process id exactly once in target order. Read PROCESS before updates/deletes/reorder. A report supports at most 10 processes. Delete uses WAIT_CONFIRM and must repeat the identical request with returned pendingActionId after confirmation. Requires idempotencyKey; MCP never automatically retries.",
1427
- cbam2_precursor_manage: "Manage manually entered purchased-precursor definitions. action=save batch-creates/updates complete rows; action=delete removes exact precursor ids. Read PRECURSOR first, and resolve category/country/route values through cbam2_reference_search. A report supports at most 20 precursors. Delete uses WAIT_CONFIRM. Requires idempotencyKey; MCP never automatically retries.",
1428
- cbam2_source_flow_manage: "Manage direct-emission source-flow rows under report processes. action=save creates/updates rows and the backend recalculates direct emissions; action=delete removes exact ids. Read SOURCE_FLOW first, use process ids from the same report, and use CBAM_ENUM codes for processMethod/sourceType. Calculated results and support files are backend-owned and are not accepted by this tool. Delete uses WAIT_CONFIRM. Requires idempotencyKey.",
1429
- cbam2_heat_power_update: "Update complete heat-power cogeneration inputs for a report whose include flag enables this section. Read HEAT_POWER first. Submit only input fields; the backend calculates outPower/outFactor and invalidates dependent sale calculations. Requires idempotencyKey.",
1430
- cbam2_product_data_update: "Update product activity/emission data for existing process or precursor rows. dataType=process requires process items with totalVolume and salesVolume; dataType=precursor requires precursor items. Read PROCESS_PRODUCT_DATA or PRECURSOR_PRODUCT_DATA first. The backend preserves definitions, validates report ownership and activity balances, replaces route rows transactionally, calculates dependent fields, and rejects server-owned result fields. Requires idempotencyKey.",
1431
- cbam2_sale_product_manage: "Manage sale products for one CBAM2 report. action=save batch-creates/updates complete form rows tied to exact report process ids; action=delete removes exact ids and dependent tax rows. Read SALE_PRODUCT first and use CN/category data from cbam2_reference_search. Calculated emissions, versions, fill status, and payTax are backend-owned. Delete uses WAIT_CONFIRM. Requires idempotencyKey.",
1432
- cbam2_carbon_tax_manage: "Manage or calculate report carbon tax. action=save batch-creates/updates rows using exact saleProductId, currency, benchmark, and source candidates returned by CBAM2 reads/reference search; action=delete removes exact ids; action=calculate starts asynchronous calculation. Read CARBON_TAX and carbon-tax candidates first. delete and calculate use WAIT_CONFIRM; after calculate succeeds, poll cbam2_report_read with view=carbon_tax_status. Requires idempotencyKey and is never automatically retried.",
1433
- cbam2_data_quality_update: "Update the complete CBAM2 data-quality form. First call cbam2_report_read view=section section=DATA_QUALITY and preserve fields the user did not change. Use CBAM_ENUM codes for enum fields. Requires idempotencyKey.",
1434
- cbam2_report_generate: "Start backend generation of the selected CBAM2 report file. General information alone is sufficient to request generation; optional missing sections remain visible through cbam2_report_read view=readiness and may produce warnings or incomplete content according to backend rules. The backend creates the file, uploads it, and records it in Carbon Cloud download management; the Agent must not create a parallel spreadsheet. This costly asynchronous action uses WAIT_CONFIRM. After confirmation repeat the identical payload/idempotencyKey with confirmed=true and pendingActionId, then poll cbam2_report_generation_status using returned generationId. Timeout/network/5xx failures are not automatically retried.",
1435
- cbam2_report_generation_status: "Poll one CBAM2 report-generation task using the exact reportId and generationId returned by cbam2_report_generate. Returns RUNNING, COMPLETED, or FAILED plus the generated download record/path when available. Read-only.",
1422
+ session_carbon_objects: "Recover product-carbon accounts, enterprise-carbon computations, and CBAM reports bound to the current Agent session. Call this before guessing a lost business id. Omit module or use all for every family; module=footprint3 returns productCarbonAccounts, module=enterprise returns enterpriseCarbonComputations, and module=cbam returns cbamReports. One session may contain multiple CBAM reports, so match by reportName/org/factory and then pass the exact cbamReports[].reportId to every report-specific tool. Never substitute an enterprise year, product accountId, or another report id. This tool is read-only and requires sessionId.",
1423
+ cbam_reference_search: "Read CBAM reference data needed for the current step: accessible organizations and factories, countries, currencies, enum codes, product categories, default processes/precursors/products/CN/sale data, or report-scoped carbon-tax candidates. Request only needed types. Use returned ids/codes exactly and never invent dictionary or organization values. CARBON_TAX_CANDIDATE requires reportId. Large reference tables are paginated with pageNum/pageSize. Read-only.",
1424
+ cbam_report_search: "Search CBAM reports accessible to the current user by optional name, organization, factory, year, and pagination. Use this or session_carbon_objects to resolve an exact reportId. A single Agent session can create and work with multiple CBAM reports; never silently select the first result when several reports match. Read-only.",
1425
+ cbam_report_read: "Unified read-only CBAM report inspection. view=snapshot returns workflow overview/counts/readiness; section returns one complete editable section and requires section; item reads one child record and requires itemType+itemId; result returns result analysis; readiness returns generation blockers/warnings; carbon_tax_status returns asynchronous carbon-tax calculation state. itemId must belong to reportId. Call the corresponding read view before a full-form update so unchanged fields are preserved.",
1426
+ cbam_factory_read: "Read the complete accessible CBAM factory form by exact factoryId. Call before updating a shared factory because factory updates are full-form writes and orgId is immutable. Read-only.",
1427
+ cbam_factory_save: "Create or fully update a shared CBAM factory. action=create omits factoryId; action=update requires factoryId and must follow cbam_factory_read, preserving unchanged fields and orgId. Country and orgId must come from cbam_reference_search. Both actions are shared-data mutations: reuse the existing Agent approval interrupt, then have the trusted wrapper inject confirmed=true and idempotencyKey before this single MCP call. MCP never automatically retries this write.",
1428
+ cbam_report_save: "Create or fully update CBAM report general information. action=create omits reportId; every create call creates a NEW report and binds it to the same Agent session without replacing earlier CBAM reports. One session may therefore contain multiple reports. action=update requires an explicit reportId and should follow cbam_report_read view=section section=GENERAL_INFO. After more than one report exists, always pass the intended reportId to subsequent tools and ask the user when context is ambiguous. Basic general information is enough to create a report and later generate it; other sections are progressive supplements. Requires idempotencyKey.",
1429
+ cbam_process_manage: "Manage self-produced CBAM process definitions for one report. action=save batch-creates/updates complete definition rows; action=delete removes exact ids; action=reorder requires every current process id exactly once in target order. Read PROCESS before updates/deletes/reorder. A report supports at most 10 processes. Delete requires the existing Agent approval interrupt and wrapper-injected confirmed=true; save/reorder do not. Requires idempotencyKey; MCP never automatically retries.",
1430
+ cbam_precursor_manage: "Manage manually entered purchased-precursor definitions. action=save batch-creates/updates complete rows; action=delete removes exact precursor ids. Read PRECURSOR first, and resolve category/country/route values through cbam_reference_search. A report supports at most 20 precursors. Delete requires prior Agent approval and wrapper-injected confirmed=true. Requires idempotencyKey; MCP never automatically retries.",
1431
+ cbam_source_flow_manage: "Manage direct-emission source-flow rows under report processes. action=save creates/updates rows and the backend recalculates direct emissions; action=delete removes exact ids. Read SOURCE_FLOW first, use process ids from the same report, and use CBAM_ENUM codes for processMethod/sourceType. Calculated results and support files are backend-owned and are not accepted by this tool. Delete requires prior Agent approval and wrapper-injected confirmed=true. Requires idempotencyKey.",
1432
+ cbam_heat_power_update: "Update complete heat-power cogeneration inputs for a report whose include flag enables this section. Read HEAT_POWER first. Submit only input fields; the backend calculates outPower/outFactor and invalidates dependent sale calculations. Requires idempotencyKey.",
1433
+ cbam_product_data_update: "Update product activity/emission data for existing process or precursor rows. dataType=process requires process items with totalVolume and salesVolume; dataType=precursor requires precursor items. Read PROCESS_PRODUCT_DATA or PRECURSOR_PRODUCT_DATA first. The backend preserves definitions, validates report ownership and activity balances, replaces route rows transactionally, calculates dependent fields, and rejects server-owned result fields. Requires idempotencyKey.",
1434
+ cbam_sale_product_manage: "Manage sale products for one CBAM report. action=save batch-creates/updates complete form rows tied to exact report process ids; action=delete removes exact ids and dependent tax rows. Read SALE_PRODUCT first and use CN/category data from cbam_reference_search. Calculated emissions, versions, fill status, and payTax are backend-owned. Delete requires prior Agent approval and wrapper-injected confirmed=true. Requires idempotencyKey.",
1435
+ cbam_carbon_tax_manage: "Manage or calculate report carbon tax. action=save batch-creates/updates rows using exact saleProductId, currency, benchmark, and source candidates returned by CBAM reads/reference search; action=delete removes exact ids; action=calculate starts asynchronous calculation. Read CARBON_TAX and carbon-tax candidates first. delete and calculate require the existing Agent approval interrupt and wrapper-injected confirmed=true; after calculate succeeds, poll cbam_report_read with view=carbon_tax_status. Requires idempotencyKey and is never automatically retried.",
1436
+ cbam_data_quality_update: "Update the complete CBAM data-quality form. First call cbam_report_read view=section section=DATA_QUALITY and preserve fields the user did not change. Use CBAM_ENUM codes for enum fields. Requires idempotencyKey.",
1437
+ cbam_report_generate: "Generate the selected CBAM report and wait for the backend file result. General information alone is sufficient to request generation; optional missing sections remain visible through cbam_report_read view=readiness and may produce warnings or incomplete content according to backend rules. The backend creates the file, uploads it, and records it in Carbon Cloud download management; the Agent must not create a parallel spreadsheet. Reuse the existing Agent approval interrupt, then have the trusted wrapper inject confirmed=true and idempotencyKey before this single MCP call. The MCP server polls the internal generation status itself and normally returns COMPLETED with the download file. If it returns RUNNING with timedOut=true, call this same tool again with the same idempotencyKey to continue waiting without creating a duplicate task. The generation write is never automatically retried after timeout/network/5xx failures.",
1438
+ cbam_report_generation_status: "Internal-only CBAM report-generation status route used by cbam_report_generate. It is intentionally not exposed to the Agent.",
1436
1439
  user_memory_recall: "Recall the current user's stored cross-session preferences, long-term constraints, carbon-domain habits, and response-style preferences. Call this when stable prior preferences can materially improve the current task, when the user asks what was remembered, and before user_memory_upsert or user_memory_forget if this turn has not already recalled the same target topic. A direct write or forget needs this lookup even when the current request supplies the new value, so the Agent can reuse an existing memoryKey and memoryId instead of creating a semantic duplicate. Do not repeatedly recall the same topic in one turn. Write query as a concise question about the preference or constraint needed now; never copy the full user message or include unrelated sensitive business data. Optional memoryTypes: preference=general preference, constraint=persistent rule or boundary, domain_habit=carbon-accounting/modeling/reporting workflow habit, format_habit=response language/structure/length/file-format habit. The response contains rules and items with memoryId, scope, type, memoryKey, normalized content, recallMode, version, and relevance metadata. count=0 is a successful empty recall; continue the task using current context. The current user request always overrides recalled memory, and current business data is authoritative. Treat recalled items as guidance, not authoritative business facts. Never reveal memory ids, versions, scores, source metadata, or internal implementation details to the user. Requires sessionId, a messageId belonging to that session, and query.",
1437
1440
  user_memory_get: "Read exactly one current-user memory by the stable memoryId returned by user_memory_recall or a previous write. Use this immediately before updating or forgetting a memory to obtain its latest version and avoid stale writes. Do not enumerate, guess, or probe memory ids, and do not use this tool to access another user or project: authorization is derived from sessionId and messageId. The response is reduced to Agent-safe fields and must not be displayed as internal metadata to the user. Requires sessionId, a messageId belonging to that session, and memoryId.",
1438
1441
  user_memory_upsert: "Create or update one stable long-term user memory. Call only when the user explicitly asks the Agent to remember a lasting preference/constraint, or after the user clearly confirms it; ordinary observations, one-off task details, sensitive data, changing business facts, account ids, emission values, and unconfirmed model inferences must not be stored. Before writing, call user_memory_recall once for the target topic unless the same topic was already recalled in this turn. If recall finds the same independently updatable slot, reuse its exact memoryKey; for an exact update, also reuse its memoryId, call user_memory_get, and preferably pass the latest positive version as expectedVersion. If recall finds no matching slot, omit memoryId and create by a new stable memoryKey. memoryId determines the operation: omit it or pass a blank value to create/upsert by memoryKey; pass a valid memoryId to update that exact item. For compatibility, expectedVersion may be omitted or 0 and the backend will use the latest version read at update time; never blindly retry a version conflict. expectedVersion is ignored when memoryId is absent. memoryKey represents one independently updatable slot: never include mutable attitude/state such as like/dislike or enabled/disabled. A single-valued attribute uses one fixed key without the changing value, such as preference.favorite_color or format.response.language. A multi-valued collection includes a canonical lowercase English object so values can coexist, such as preference.color.white and preference.color.red; liking and disliking white both reuse preference.color.white. Different wording or languages for the same slot or object must reuse the recalled key. USER applies across sessions; USER_PROJECT applies only to the current session project, which the backend derives automatically. Prefer source=EXPLICIT_USER for a direct request or CONFIRMED_CONVERSATION after confirmation. Use ALWAYS for persistent constraints/response-style rules and SEMANTIC for context-dependent preferences, or omit recallMode for the backend default. Requires sessionId, messageId, scope, type, memoryKey, and normalized content no longer than 120 characters. MCP never automatically retries this write.",
@@ -1501,134 +1504,139 @@ export const toolRoutes = {
1501
1504
  method: "POST",
1502
1505
  path: apipath.SessionBusinessRefs(),
1503
1506
  bodyKind: "sessionContext",
1507
+ responseKind: "sessionCarbonObjects",
1504
1508
  },
1505
- cbam2_reference_search: {
1509
+ cbam_reference_search: {
1506
1510
  method: "POST",
1507
- path: apipath.Cbam2ReferenceSearch(),
1508
- bodyKind: "cbam2",
1511
+ path: apipath.CbamReferenceSearch(),
1512
+ bodyKind: "cbam",
1509
1513
  },
1510
- cbam2_report_search: {
1514
+ cbam_report_search: {
1511
1515
  method: "POST",
1512
- path: apipath.Cbam2ReportSearch(),
1513
- bodyKind: "cbam2",
1516
+ path: apipath.CbamReportSearch(),
1517
+ bodyKind: "cbam",
1514
1518
  },
1515
- cbam2_report_read: {
1519
+ cbam_report_read: {
1516
1520
  method: "POST",
1517
1521
  path: (args) => {
1518
1522
  if (args.view === "section")
1519
- return apipath.Cbam2SectionSnapshot();
1523
+ return apipath.CbamSectionSnapshot();
1520
1524
  if (args.view === "item")
1521
- return apipath.Cbam2ItemDetail();
1525
+ return apipath.CbamItemDetail();
1522
1526
  if (args.view === "result")
1523
- return apipath.Cbam2ResultSummary();
1527
+ return apipath.CbamResultSummary();
1524
1528
  if (args.view === "readiness")
1525
- return apipath.Cbam2ReportReadiness();
1529
+ return apipath.CbamReportReadiness();
1526
1530
  if (args.view === "carbon_tax_status")
1527
- return apipath.Cbam2CarbonTaxStatus();
1528
- return apipath.Cbam2ReportSnapshot();
1531
+ return apipath.CbamCarbonTaxStatus();
1532
+ return apipath.CbamReportSnapshot();
1529
1533
  },
1530
- bodyKind: "cbam2",
1534
+ bodyKind: "cbam",
1531
1535
  },
1532
- cbam2_factory_read: {
1536
+ cbam_factory_read: {
1533
1537
  method: "POST",
1534
- path: apipath.Cbam2FactoryDetail(),
1535
- bodyKind: "cbam2",
1538
+ path: apipath.CbamFactoryDetail(),
1539
+ bodyKind: "cbam",
1536
1540
  },
1537
- cbam2_factory_save: {
1541
+ cbam_factory_save: {
1538
1542
  method: "POST",
1539
1543
  path: (args) => args.action === "update"
1540
- ? apipath.Cbam2FactoryUpdate()
1541
- : apipath.Cbam2FactoryCreate(),
1542
- bodyKind: "cbam2",
1544
+ ? apipath.CbamFactoryUpdate()
1545
+ : apipath.CbamFactoryCreate(),
1546
+ bodyKind: "cbam",
1543
1547
  maxRetries: 0,
1544
1548
  },
1545
- cbam2_report_save: {
1549
+ cbam_report_save: {
1546
1550
  method: "POST",
1547
1551
  path: (args) => args.action === "update"
1548
- ? apipath.Cbam2ReportUpdate()
1549
- : apipath.Cbam2ReportCreate(),
1550
- bodyKind: "cbam2",
1552
+ ? apipath.CbamReportUpdate()
1553
+ : apipath.CbamReportCreate(),
1554
+ bodyKind: "cbam",
1551
1555
  maxRetries: 0,
1552
1556
  },
1553
- cbam2_process_manage: {
1557
+ cbam_process_manage: {
1554
1558
  method: "POST",
1555
1559
  path: (args) => {
1556
1560
  if (args.action === "delete")
1557
- return apipath.Cbam2ProcessBatchDelete();
1561
+ return apipath.CbamProcessBatchDelete();
1558
1562
  if (args.action === "reorder")
1559
- return apipath.Cbam2ProcessReorder();
1560
- return apipath.Cbam2ProcessBatchSave();
1563
+ return apipath.CbamProcessReorder();
1564
+ return apipath.CbamProcessBatchSave();
1561
1565
  },
1562
- bodyKind: "cbam2",
1566
+ bodyKind: "cbam",
1563
1567
  maxRetries: 0,
1564
1568
  },
1565
- cbam2_precursor_manage: {
1569
+ cbam_precursor_manage: {
1566
1570
  method: "POST",
1567
1571
  path: (args) => args.action === "delete"
1568
- ? apipath.Cbam2PrecursorBatchDelete()
1569
- : apipath.Cbam2PrecursorBatchSave(),
1570
- bodyKind: "cbam2",
1572
+ ? apipath.CbamPrecursorBatchDelete()
1573
+ : apipath.CbamPrecursorBatchSave(),
1574
+ bodyKind: "cbam",
1571
1575
  maxRetries: 0,
1572
1576
  },
1573
- cbam2_source_flow_manage: {
1577
+ cbam_source_flow_manage: {
1574
1578
  method: "POST",
1575
1579
  path: (args) => args.action === "delete"
1576
- ? apipath.Cbam2SourceFlowBatchDelete()
1577
- : apipath.Cbam2SourceFlowBatchSave(),
1578
- bodyKind: "cbam2",
1580
+ ? apipath.CbamSourceFlowBatchDelete()
1581
+ : apipath.CbamSourceFlowBatchSave(),
1582
+ bodyKind: "cbam",
1579
1583
  maxRetries: 0,
1580
1584
  },
1581
- cbam2_heat_power_update: {
1585
+ cbam_heat_power_update: {
1582
1586
  method: "POST",
1583
- path: apipath.Cbam2HeatPowerUpdate(),
1584
- bodyKind: "cbam2",
1587
+ path: apipath.CbamHeatPowerUpdate(),
1588
+ bodyKind: "cbam",
1585
1589
  maxRetries: 0,
1586
1590
  },
1587
- cbam2_product_data_update: {
1591
+ cbam_product_data_update: {
1588
1592
  method: "POST",
1589
1593
  path: (args) => args.dataType === "precursor"
1590
- ? apipath.Cbam2PrecursorProductBatchUpdate()
1591
- : apipath.Cbam2ProcessProductBatchUpdate(),
1592
- bodyKind: "cbam2",
1594
+ ? apipath.CbamPrecursorProductBatchUpdate()
1595
+ : apipath.CbamProcessProductBatchUpdate(),
1596
+ bodyKind: "cbam",
1593
1597
  maxRetries: 0,
1594
1598
  },
1595
- cbam2_sale_product_manage: {
1599
+ cbam_sale_product_manage: {
1596
1600
  method: "POST",
1597
1601
  path: (args) => args.action === "delete"
1598
- ? apipath.Cbam2SaleProductBatchDelete()
1599
- : apipath.Cbam2SaleProductBatchSave(),
1600
- bodyKind: "cbam2",
1602
+ ? apipath.CbamSaleProductBatchDelete()
1603
+ : apipath.CbamSaleProductBatchSave(),
1604
+ bodyKind: "cbam",
1601
1605
  maxRetries: 0,
1602
1606
  },
1603
- cbam2_carbon_tax_manage: {
1607
+ cbam_carbon_tax_manage: {
1604
1608
  method: "POST",
1605
1609
  path: (args) => {
1606
1610
  if (args.action === "delete")
1607
- return apipath.Cbam2CarbonTaxBatchDelete();
1611
+ return apipath.CbamCarbonTaxBatchDelete();
1608
1612
  if (args.action === "calculate")
1609
- return apipath.Cbam2CarbonTaxCalculate();
1610
- return apipath.Cbam2CarbonTaxBatchSave();
1613
+ return apipath.CbamCarbonTaxCalculate();
1614
+ return apipath.CbamCarbonTaxBatchSave();
1611
1615
  },
1612
- bodyKind: "cbam2",
1616
+ bodyKind: "cbam",
1613
1617
  maxRetries: 0,
1614
1618
  },
1615
- cbam2_data_quality_update: {
1619
+ cbam_data_quality_update: {
1616
1620
  method: "POST",
1617
- path: apipath.Cbam2DataQualityUpdate(),
1618
- bodyKind: "cbam2",
1621
+ path: apipath.CbamDataQualityUpdate(),
1622
+ bodyKind: "cbam",
1619
1623
  maxRetries: 0,
1620
1624
  },
1621
- cbam2_report_generate: {
1625
+ cbam_report_generate: {
1622
1626
  method: "POST",
1623
- path: apipath.Cbam2ReportGenerate(),
1624
- bodyKind: "cbam2",
1625
- timeoutSeconds: 120,
1627
+ path: apipath.CbamReportGenerate(),
1628
+ bodyKind: "cbam",
1629
+ // This endpoint only creates the asynchronous generation task. The MCP
1630
+ // composite call owns a separate 120-second total start-and-poll budget.
1631
+ timeoutSeconds: 20,
1632
+ exactTimeout: true,
1626
1633
  maxRetries: 0,
1627
1634
  },
1628
- cbam2_report_generation_status: {
1635
+ cbam_report_generation_status: {
1629
1636
  method: "POST",
1630
- path: apipath.Cbam2ReportGenerationStatus(),
1631
- bodyKind: "cbam2",
1637
+ path: apipath.CbamReportGenerationStatus(),
1638
+ bodyKind: "cbam",
1639
+ maxRetries: 0,
1632
1640
  },
1633
1641
  user_memory_recall: {
1634
1642
  method: "POST",
@@ -1942,7 +1950,7 @@ export const toolRoutes = {
1942
1950
  },
1943
1951
  };
1944
1952
  export function buildBody(route, args) {
1945
- if (route.bodyKind === "cbam2") {
1953
+ if (route.bodyKind === "cbam") {
1946
1954
  const body = { ...args };
1947
1955
  const action = body.action;
1948
1956
  const view = body.view;
@@ -1971,18 +1979,21 @@ export function buildBody(route, args) {
1971
1979
  delete body.items;
1972
1980
  delete body.ids;
1973
1981
  }
1974
- const confirmationRequired = route === toolRoutes.cbam2_factory_save
1975
- || route === toolRoutes.cbam2_report_generate
1982
+ const confirmationRequired = route === toolRoutes.cbam_factory_save
1983
+ || route === toolRoutes.cbam_report_generate
1976
1984
  || action === "delete"
1977
1985
  || action === "calculate";
1978
1986
  if (!confirmationRequired) {
1979
1987
  delete body.confirmed;
1980
- delete body.pendingActionId;
1981
1988
  }
1982
- return normalizeCbam2Codes(normalizeIds(pickDefined(body)));
1989
+ return normalizeCbamCodes(normalizeIds(pickDefined(body)));
1983
1990
  }
1984
1991
  if (route.bodyKind === "sessionContext") {
1985
- return pickDefined({ sessionId: args.sessionId, module: args.module });
1992
+ return pickDefined({
1993
+ sessionId: args.sessionId,
1994
+ // The Agent-facing module is CBAM; the existing Java contract still uses cbam2.
1995
+ module: args.module === "cbam" ? "cbam2" : args.module,
1996
+ });
1986
1997
  }
1987
1998
  if (route.bodyKind === "projectRead") {
1988
1999
  const projectTaskId = typeof args.projectTaskId === "string"
@@ -2228,7 +2239,7 @@ function normalizeEnterpriseEmissionSource(source, gasListField) {
2228
2239
  function normalizeNumericCode(value) {
2229
2240
  return typeof value === "string" && /^\d+$/.test(value) ? Number(value) : value;
2230
2241
  }
2231
- const cbam2NumericCodeFields = new Set([
2242
+ const cbamNumericCodeFields = new Set([
2232
2243
  "include",
2233
2244
  "includeType",
2234
2245
  "processMethod",
@@ -2252,22 +2263,22 @@ const cbam2NumericCodeFields = new Set([
2252
2263
  "qualityAssurance",
2253
2264
  "orderNum",
2254
2265
  ]);
2255
- const cbam2GenericIdFields = new Set(["id"]);
2256
- function normalizeCbam2Codes(value) {
2266
+ const cbamGenericIdFields = new Set(["id"]);
2267
+ function normalizeCbamCodes(value) {
2257
2268
  if (Array.isArray(value))
2258
- return value.map(normalizeCbam2Codes);
2269
+ return value.map(normalizeCbamCodes);
2259
2270
  if (!value || typeof value !== "object")
2260
2271
  return value;
2261
2272
  const result = {};
2262
2273
  for (const [key, childValue] of Object.entries(value)) {
2263
- if (cbam2NumericCodeFields.has(key)) {
2274
+ if (cbamNumericCodeFields.has(key)) {
2264
2275
  result[key] = normalizeNumericCode(childValue);
2265
2276
  }
2266
- else if (cbam2GenericIdFields.has(key) && typeof childValue === "string" && /^\d+$/.test(childValue)) {
2277
+ else if (cbamGenericIdFields.has(key) && typeof childValue === "string" && /^\d+$/.test(childValue)) {
2267
2278
  result[key] = normalizeNumericId(childValue);
2268
2279
  }
2269
2280
  else {
2270
- result[key] = normalizeCbam2Codes(childValue);
2281
+ result[key] = normalizeCbamCodes(childValue);
2271
2282
  }
2272
2283
  }
2273
2284
  return result;
@@ -2281,8 +2292,8 @@ function normalizeDecimalValue(value) {
2281
2292
  return Number(normalized);
2282
2293
  }
2283
2294
  export function validateToolArgs(name, args) {
2284
- if (name.startsWith("cbam2_")) {
2285
- validateCbam2Args(name, args);
2295
+ if (name.startsWith("cbam_")) {
2296
+ validateCbamArgs(name, args);
2286
2297
  return;
2287
2298
  }
2288
2299
  if (name === "enterprise_emission_batch_save" && Array.isArray(args.orgList)) {
@@ -2293,122 +2304,122 @@ export function validateToolArgs(name, args) {
2293
2304
  validateEnterpriseEmissionUpdateArgs(args.computationList);
2294
2305
  }
2295
2306
  }
2296
- function validateCbam2Args(name, args) {
2297
- if (name === "cbam2_reference_search") {
2307
+ function validateCbamArgs(name, args) {
2308
+ if (name === "cbam_reference_search") {
2298
2309
  const types = Array.isArray(args.types) ? args.types.map(String) : [];
2299
2310
  requireUniqueValues(types, "types");
2300
2311
  if (types.includes("CARBON_TAX_CANDIDATE") && args.reportId === undefined) {
2301
- cbam2InputError("REPORT_ID_REQUIRED", "reportId", "reportId is required when types contains CARBON_TAX_CANDIDATE");
2312
+ cbamInputError("REPORT_ID_REQUIRED", "reportId", "reportId is required when types contains CARBON_TAX_CANDIDATE");
2302
2313
  }
2303
2314
  return;
2304
2315
  }
2305
- if (name === "cbam2_report_read") {
2316
+ if (name === "cbam_report_read") {
2306
2317
  if (args.view === "section" && args.section === undefined) {
2307
- cbam2InputError("SECTION_REQUIRED", "section", "section is required when view=section");
2318
+ cbamInputError("SECTION_REQUIRED", "section", "section is required when view=section");
2308
2319
  }
2309
2320
  if (args.view === "item") {
2310
2321
  if (args.itemType === undefined)
2311
- cbam2InputError("ITEM_TYPE_REQUIRED", "itemType", "itemType is required when view=item");
2322
+ cbamInputError("ITEM_TYPE_REQUIRED", "itemType", "itemType is required when view=item");
2312
2323
  if (args.itemId === undefined)
2313
- cbam2InputError("ITEM_ID_REQUIRED", "itemId", "itemId is required when view=item");
2324
+ cbamInputError("ITEM_ID_REQUIRED", "itemId", "itemId is required when view=item");
2314
2325
  }
2315
2326
  return;
2316
2327
  }
2317
- if (name === "cbam2_factory_save") {
2328
+ if (name === "cbam_factory_save") {
2318
2329
  validateCreateUpdateId(args, "factoryId");
2319
- validateCbam2Confirmation(args, true);
2330
+ validateCbamConfirmation(args, true);
2320
2331
  return;
2321
2332
  }
2322
- if (name === "cbam2_report_save") {
2333
+ if (name === "cbam_report_save") {
2323
2334
  validateCreateUpdateId(args, "reportId");
2324
2335
  const report = args.report;
2325
2336
  if (report)
2326
- validateCbam2DateRange(report.startDate, report.endDate);
2337
+ validateCbamDateRange(report.startDate, report.endDate);
2327
2338
  return;
2328
2339
  }
2329
- if (name === "cbam2_process_manage") {
2330
- validateCbam2ActionPayload(args, ["save", "delete", "reorder"]);
2340
+ if (name === "cbam_process_manage") {
2341
+ validateCbamActionPayload(args, ["save", "delete", "reorder"]);
2331
2342
  if (args.action === "reorder" || args.action === "delete")
2332
2343
  requireUniqueIdArray(args.ids, "ids");
2333
2344
  if (args.action === "save")
2334
2345
  requireUniqueItemIds(args.items);
2335
- validateCbam2Confirmation(args, args.action === "delete");
2346
+ validateCbamConfirmation(args, args.action === "delete");
2336
2347
  return;
2337
2348
  }
2338
- if (["cbam2_precursor_manage", "cbam2_source_flow_manage", "cbam2_sale_product_manage"].includes(name)) {
2339
- validateCbam2ActionPayload(args, ["save", "delete"]);
2349
+ if (["cbam_precursor_manage", "cbam_source_flow_manage", "cbam_sale_product_manage"].includes(name)) {
2350
+ validateCbamActionPayload(args, ["save", "delete"]);
2340
2351
  if (args.action === "delete")
2341
2352
  requireUniqueIdArray(args.ids, "ids");
2342
2353
  if (args.action === "save")
2343
2354
  requireUniqueItemIds(args.items);
2344
- if (name === "cbam2_source_flow_manage" && args.action === "save") {
2345
- validateCbam2SourceFlows(args.items);
2355
+ if (name === "cbam_source_flow_manage" && args.action === "save") {
2356
+ validateCbamSourceFlows(args.items);
2346
2357
  }
2347
- validateCbam2Confirmation(args, args.action === "delete");
2358
+ validateCbamConfirmation(args, args.action === "delete");
2348
2359
  return;
2349
2360
  }
2350
- if (name === "cbam2_carbon_tax_manage") {
2351
- validateCbam2ActionPayload(args, ["save", "delete", "calculate"]);
2361
+ if (name === "cbam_carbon_tax_manage") {
2362
+ validateCbamActionPayload(args, ["save", "delete", "calculate"]);
2352
2363
  if (args.action === "delete")
2353
2364
  requireUniqueIdArray(args.ids, "ids");
2354
2365
  if (args.action === "save")
2355
2366
  requireUniqueItemIds(args.items);
2356
- validateCbam2Confirmation(args, args.action === "delete" || args.action === "calculate");
2367
+ validateCbamConfirmation(args, args.action === "delete" || args.action === "calculate");
2357
2368
  return;
2358
2369
  }
2359
- if (name === "cbam2_product_data_update") {
2370
+ if (name === "cbam_product_data_update") {
2360
2371
  const itemSchema = args.dataType === "precursor"
2361
- ? cbam2PrecursorProductData
2362
- : cbam2ProcessProductData;
2372
+ ? cbamPrecursorProductData
2373
+ : cbamProcessProductData;
2363
2374
  const items = Array.isArray(args.items) ? args.items : [];
2364
2375
  for (let index = 0; index < items.length; index++) {
2365
2376
  if (!itemSchema.safeParse(items[index]).success) {
2366
- cbam2InputError("PRODUCT_DATA_TYPE_MISMATCH", `items[${index}]`, `item does not match dataType=${String(args.dataType)}`);
2377
+ cbamInputError("PRODUCT_DATA_TYPE_MISMATCH", `items[${index}]`, `item does not match dataType=${String(args.dataType)}`);
2367
2378
  }
2368
2379
  }
2369
2380
  requireUniqueItemIds(items);
2370
2381
  return;
2371
2382
  }
2372
- if (name === "cbam2_report_generate") {
2373
- validateCbam2Confirmation(args, true);
2383
+ if (name === "cbam_report_generate") {
2384
+ validateCbamConfirmation(args, true);
2374
2385
  }
2375
2386
  }
2376
2387
  function validateCreateUpdateId(args, idField) {
2377
2388
  if (args.action === "update" && args[idField] === undefined) {
2378
- cbam2InputError("ID_REQUIRED", idField, `${idField} is required when action=update`);
2389
+ cbamInputError("ID_REQUIRED", idField, `${idField} is required when action=update`);
2379
2390
  }
2380
2391
  if (args.action === "create" && args[idField] !== undefined) {
2381
- cbam2InputError("ID_NOT_ALLOWED", idField, `${idField} must be omitted when action=create`);
2392
+ cbamInputError("ID_NOT_ALLOWED", idField, `${idField} must be omitted when action=create`);
2382
2393
  }
2383
2394
  }
2384
- function validateCbam2ActionPayload(args, supported) {
2395
+ function validateCbamActionPayload(args, supported) {
2385
2396
  const action = String(args.action || "");
2386
2397
  if (!supported.includes(action))
2387
- cbam2InputError("INVALID_ACTION", "action", `unsupported action: ${action}`);
2398
+ cbamInputError("INVALID_ACTION", "action", `unsupported action: ${action}`);
2388
2399
  if (action === "save") {
2389
2400
  requireNonEmptyArray(args.items, "items");
2390
2401
  if (args.ids !== undefined)
2391
- cbam2InputError("UNEXPECTED_IDS", "ids", "ids must be omitted when action=save");
2402
+ cbamInputError("UNEXPECTED_IDS", "ids", "ids must be omitted when action=save");
2392
2403
  }
2393
2404
  else if (action === "delete" || action === "reorder") {
2394
2405
  requireNonEmptyArray(args.ids, "ids");
2395
2406
  if (args.items !== undefined)
2396
- cbam2InputError("UNEXPECTED_ITEMS", "items", `items must be omitted when action=${action}`);
2407
+ cbamInputError("UNEXPECTED_ITEMS", "items", `items must be omitted when action=${action}`);
2397
2408
  }
2398
2409
  else if (action === "calculate") {
2399
2410
  if (args.items !== undefined || args.ids !== undefined) {
2400
- cbam2InputError("UNEXPECTED_PAYLOAD", "items", "items and ids must be omitted when action=calculate");
2411
+ cbamInputError("UNEXPECTED_PAYLOAD", "items", "items and ids must be omitted when action=calculate");
2401
2412
  }
2402
2413
  }
2403
2414
  }
2404
- function validateCbam2Confirmation(args, required) {
2405
- if (!required || args.confirmed !== true)
2415
+ function validateCbamConfirmation(args, required) {
2416
+ if (!required)
2406
2417
  return;
2407
- if (typeof args.pendingActionId !== "string" || args.pendingActionId.trim().length === 0) {
2408
- cbam2InputError("PENDING_ACTION_ID_REQUIRED", "pendingActionId", "pendingActionId returned by WAIT_CONFIRM is required when confirmed=true");
2409
- }
2418
+ if (args.confirmed === true)
2419
+ return;
2420
+ cbamInputError("CONFIRMATION_REQUIRED", "confirmed", "confirmed=true must be injected by the trusted Agent wrapper after user approval");
2410
2421
  }
2411
- function validateCbam2SourceFlows(value) {
2422
+ function validateCbamSourceFlows(value) {
2412
2423
  if (!Array.isArray(value))
2413
2424
  return;
2414
2425
  for (let index = 0; index < value.length; index++) {
@@ -2420,45 +2431,45 @@ function validateCbam2SourceFlows(value) {
2420
2431
  const processMethod = numericCode(source.processMethod);
2421
2432
  const path = `items[${index}]`;
2422
2433
  if (![1, 2, 3].includes(sourceType)) {
2423
- cbam2InputError("INVALID_SOURCE_FLOW_TYPE", `${path}.sourceType`, "sourceType must be 1, 2, or 3");
2434
+ cbamInputError("INVALID_SOURCE_FLOW_TYPE", `${path}.sourceType`, "sourceType must be 1, 2, or 3");
2424
2435
  }
2425
2436
  if (![1, 2, 3, 4, 5, 6, 7].includes(processMethod)) {
2426
- cbam2InputError("INVALID_PROCESS_METHOD", `${path}.processMethod`, "processMethod must be between 1 and 7");
2437
+ cbamInputError("INVALID_PROCESS_METHOD", `${path}.processMethod`, "processMethod must be between 1 and 7");
2427
2438
  }
2428
2439
  if (sourceType === 1 && ![1, 2, 3].includes(processMethod)) {
2429
- cbam2InputError("INVALID_SOURCE_FLOW_COMBINATION", `${path}.processMethod`, "sourceType=1 supports processMethod 1, 2, or 3");
2440
+ cbamInputError("INVALID_SOURCE_FLOW_COMBINATION", `${path}.processMethod`, "sourceType=1 supports processMethod 1, 2, or 3");
2430
2441
  }
2431
2442
  if (sourceType === 2 && ![4, 5].includes(processMethod)) {
2432
- cbam2InputError("INVALID_SOURCE_FLOW_COMBINATION", `${path}.processMethod`, "sourceType=2 supports processMethod 4 or 5");
2443
+ cbamInputError("INVALID_SOURCE_FLOW_COMBINATION", `${path}.processMethod`, "sourceType=2 supports processMethod 4 or 5");
2433
2444
  }
2434
2445
  if (sourceType === 3 && ![6, 7].includes(processMethod)) {
2435
- cbam2InputError("INVALID_SOURCE_FLOW_COMBINATION", `${path}.processMethod`, "sourceType=3 supports processMethod 6 or 7");
2446
+ cbamInputError("INVALID_SOURCE_FLOW_COMBINATION", `${path}.processMethod`, "sourceType=3 supports processMethod 6 or 7");
2436
2447
  }
2437
2448
  if (sourceType === 1 && processMethod === 1) {
2438
- requireCbam2Fields(source, path, ["activityData", "emissionCoefficient", "oxRate"]);
2449
+ requireCbamFields(source, path, ["activityData", "emissionCoefficient", "oxRate"]);
2439
2450
  requireLowHeatForEnergyUnit(source, path);
2440
2451
  }
2441
2452
  else if (sourceType === 1 && processMethod === 2) {
2442
- requireCbam2Fields(source, path, ["activityData", "emissionCoefficient", "conversionRate"]);
2453
+ requireCbamFields(source, path, ["activityData", "emissionCoefficient", "conversionRate"]);
2443
2454
  requireLowHeatForEnergyUnit(source, path);
2444
2455
  }
2445
2456
  else if (sourceType === 1 && processMethod === 3) {
2446
- requireCbam2Fields(source, path, ["activityData", "carbon", "biomassContent"]);
2457
+ requireCbamFields(source, path, ["activityData", "carbon", "biomassContent"]);
2447
2458
  }
2448
2459
  else if (sourceType === 2 && processMethod === 4) {
2449
- requireCbam2Fields(source, path, ["activityData", "lowHeat", "emissionCoefficient", "conversionRate", "oxRate"]);
2460
+ requireCbamFields(source, path, ["activityData", "lowHeat", "emissionCoefficient", "conversionRate", "oxRate"]);
2450
2461
  }
2451
2462
  else if (sourceType === 2 && processMethod === 5) {
2452
- requireCbam2Fields(source, path, ["activityData", "biomassContent", "carbon", "carbonFossil", "carbonBiological", "oxRate"]);
2463
+ requireCbamFields(source, path, ["activityData", "biomassContent", "carbon", "carbonFossil", "carbonBiological", "oxRate"]);
2453
2464
  if (Number(source.carbonFossil) === 0) {
2454
- cbam2InputError("INVALID_SOURCE_FLOW_VALUE", `${path}.carbonFossil`, "carbonFossil must be greater than zero for sourceType=2/processMethod=5");
2465
+ cbamInputError("INVALID_SOURCE_FLOW_VALUE", `${path}.carbonFossil`, "carbonFossil must be greater than zero for sourceType=2/processMethod=5");
2455
2466
  }
2456
2467
  if (Number(source.carbon) === 0) {
2457
- cbam2InputError("INVALID_SOURCE_FLOW_VALUE", `${path}.carbon`, "carbon must be greater than zero for sourceType=2/processMethod=5");
2468
+ cbamInputError("INVALID_SOURCE_FLOW_VALUE", `${path}.carbon`, "carbon must be greater than zero for sourceType=2/processMethod=5");
2458
2469
  }
2459
2470
  }
2460
2471
  else if (sourceType === 3 && [6, 7].includes(processMethod)) {
2461
- requireCbam2Fields(source, path, ["lowHeat", "emissionCoefficient", "conversionRate", "biomassContent"]);
2472
+ requireCbamFields(source, path, ["lowHeat", "emissionCoefficient", "conversionRate", "biomassContent"]);
2462
2473
  }
2463
2474
  }
2464
2475
  }
@@ -2469,27 +2480,27 @@ function numericCode(value) {
2469
2480
  return Number(value.trim());
2470
2481
  return Number.NaN;
2471
2482
  }
2472
- function requireCbam2Fields(item, path, fields) {
2483
+ function requireCbamFields(item, path, fields) {
2473
2484
  for (const field of fields) {
2474
2485
  if (item[field] === undefined || item[field] === null || item[field] === "") {
2475
- cbam2InputError("SOURCE_FLOW_FIELD_REQUIRED", `${path}.${field}`, `${field} is required for the selected sourceType/processMethod formula`);
2486
+ cbamInputError("SOURCE_FLOW_FIELD_REQUIRED", `${path}.${field}`, `${field} is required for the selected sourceType/processMethod formula`);
2476
2487
  }
2477
2488
  }
2478
2489
  }
2479
2490
  function requireLowHeatForEnergyUnit(item, path) {
2480
2491
  if (item.emissionCoefficientUnit === "tCO2/TJ") {
2481
- requireCbam2Fields(item, path, ["lowHeat"]);
2492
+ requireCbamFields(item, path, ["lowHeat"]);
2482
2493
  }
2483
2494
  }
2484
- function validateCbam2DateRange(startValue, endValue) {
2495
+ function validateCbamDateRange(startValue, endValue) {
2485
2496
  const start = String(startValue || "");
2486
2497
  const end = String(endValue || "");
2487
2498
  if (!isExactCalendarDate(start))
2488
- cbam2InputError("INVALID_DATE", "report.startDate", "startDate must be a valid yyyy-MM-dd date");
2499
+ cbamInputError("INVALID_DATE", "report.startDate", "startDate must be a valid yyyy-MM-dd date");
2489
2500
  if (!isExactCalendarDate(end))
2490
- cbam2InputError("INVALID_DATE", "report.endDate", "endDate must be a valid yyyy-MM-dd date");
2501
+ cbamInputError("INVALID_DATE", "report.endDate", "endDate must be a valid yyyy-MM-dd date");
2491
2502
  if (start > end)
2492
- cbam2InputError("INVALID_PERIOD", "report.startDate", "startDate must not be after endDate");
2503
+ cbamInputError("INVALID_PERIOD", "report.startDate", "startDate must not be after endDate");
2493
2504
  }
2494
2505
  function isExactCalendarDate(value) {
2495
2506
  const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
@@ -2505,7 +2516,7 @@ function isExactCalendarDate(value) {
2505
2516
  }
2506
2517
  function requireNonEmptyArray(value, path) {
2507
2518
  if (!Array.isArray(value) || value.length === 0) {
2508
- cbam2InputError("NON_EMPTY_ARRAY_REQUIRED", path, `${path} must be a non-empty array`);
2519
+ cbamInputError("NON_EMPTY_ARRAY_REQUIRED", path, `${path} must be a non-empty array`);
2509
2520
  }
2510
2521
  }
2511
2522
  function requireUniqueIdArray(value, path) {
@@ -2527,11 +2538,11 @@ function requireUniqueValues(values, path) {
2527
2538
  const seen = new Set();
2528
2539
  for (const value of values) {
2529
2540
  if (seen.has(value))
2530
- cbam2InputError("DUPLICATE_VALUE", path, `${path} must not contain duplicate values`);
2541
+ cbamInputError("DUPLICATE_VALUE", path, `${path} must not contain duplicate values`);
2531
2542
  seen.add(value);
2532
2543
  }
2533
2544
  }
2534
- function cbam2InputError(code, path, message) {
2545
+ function cbamInputError(code, path, message) {
2535
2546
  throw new ToolInputValidationError(code, path, message);
2536
2547
  }
2537
2548
  function validateEnterpriseEmissionSaveArgs(orgList) {