@carbonstopper/agent-mcp 0.1.46 → 0.1.48
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/AGENTS.md +2 -0
- package/README.md +45 -4
- package/dist/apipath.d.ts +31 -0
- package/dist/apipath.js +34 -0
- package/dist/apipath.js.map +1 -1
- package/dist/logger.js +29 -5
- package/dist/logger.js.map +1 -1
- package/dist/response.d.ts +1 -1
- package/dist/response.js +28 -5
- package/dist/response.js.map +1 -1
- package/dist/tools.d.ts +3 -3
- package/dist/tools.js +881 -6
- package/dist/tools.js.map +1 -1
- package/docs/cbam-agent-integration-guide.md +937 -0
- package/docs/schema-audit.md +26 -5
- package/package.json +1 -1
package/dist/tools.js
CHANGED
|
@@ -516,13 +516,382 @@ 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 cbamLanguage = z.enum(["zh", "en"])
|
|
520
|
+
.optional()
|
|
521
|
+
.describe("Response language for this CBAM call. Omit to use Chinese; supported values are zh and en.");
|
|
522
|
+
const cbamCode = z.union([
|
|
523
|
+
z.number().int().nonnegative(),
|
|
524
|
+
z.string().trim().regex(/^\d+$/, "Expected a numeric CBAM code"),
|
|
525
|
+
]);
|
|
526
|
+
const cbamZeroOne = z.union([
|
|
527
|
+
z.literal(0),
|
|
528
|
+
z.literal(1),
|
|
529
|
+
z.literal("0"),
|
|
530
|
+
z.literal("1"),
|
|
531
|
+
]);
|
|
532
|
+
const cbamDate = z.string().trim()
|
|
533
|
+
.regex(/^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])$/, "Expected yyyy-MM-dd")
|
|
534
|
+
.describe("Calendar date in yyyy-MM-dd format.");
|
|
535
|
+
const cbamReadFields = {
|
|
536
|
+
sessionId,
|
|
537
|
+
...skillTraceFields,
|
|
538
|
+
lang: cbamLanguage,
|
|
539
|
+
};
|
|
540
|
+
const cbamWriteFields = {
|
|
541
|
+
...cbamReadFields,
|
|
542
|
+
idempotencyKey: idempotencyKey.max(128),
|
|
543
|
+
};
|
|
544
|
+
const cbamConfirmedWriteFields = {
|
|
545
|
+
...cbamWriteFields,
|
|
546
|
+
...confirmedActionFields,
|
|
547
|
+
};
|
|
548
|
+
const cbamReferenceType = z.enum([
|
|
549
|
+
"ORGANIZATION",
|
|
550
|
+
"FACTORY",
|
|
551
|
+
"COUNTRY",
|
|
552
|
+
"CURRENCY",
|
|
553
|
+
"CBAM_ENUM",
|
|
554
|
+
"PRODUCT_CATEGORY",
|
|
555
|
+
"DEFAULT_PROCESS",
|
|
556
|
+
"DEFAULT_PRECURSOR",
|
|
557
|
+
"DEFAULT_PRODUCT",
|
|
558
|
+
"DEFAULT_CN",
|
|
559
|
+
"DEFAULT_SALE",
|
|
560
|
+
"CARBON_TAX_CANDIDATE",
|
|
561
|
+
]);
|
|
562
|
+
const cbamSection = z.enum([
|
|
563
|
+
"GENERAL_INFO",
|
|
564
|
+
"PROCESS",
|
|
565
|
+
"PRECURSOR",
|
|
566
|
+
"SOURCE_FLOW",
|
|
567
|
+
"HEAT_POWER",
|
|
568
|
+
"PROCESS_PRODUCT_DATA",
|
|
569
|
+
"PRECURSOR_PRODUCT_DATA",
|
|
570
|
+
"SALE_PRODUCT",
|
|
571
|
+
"CARBON_TAX",
|
|
572
|
+
"DATA_QUALITY",
|
|
573
|
+
"RESULT_SUMMARY",
|
|
574
|
+
]);
|
|
575
|
+
const cbamItemType = z.enum([
|
|
576
|
+
"PROCESS",
|
|
577
|
+
"PRECURSOR",
|
|
578
|
+
"SOURCE_FLOW",
|
|
579
|
+
"HEAT_POWER",
|
|
580
|
+
"SALE_PRODUCT",
|
|
581
|
+
"CARBON_TAX",
|
|
582
|
+
"DATA_QUALITY",
|
|
583
|
+
]);
|
|
584
|
+
function cbamCoordinate(minimum, maximum, name) {
|
|
585
|
+
return z.string().trim().min(1).max(50)
|
|
586
|
+
.refine((value) => Number.isFinite(Number(value)), `${name} must be a decimal number`)
|
|
587
|
+
.refine((value) => Number(value) >= minimum && Number(value) <= maximum, `${name} must be between ${minimum} and ${maximum}`);
|
|
588
|
+
}
|
|
589
|
+
const cbamFactoryForm = z.object({
|
|
590
|
+
factorName: z.string().trim().min(1).max(100).describe("Factory Chinese or local name."),
|
|
591
|
+
orgId: longId.describe("Organization id returned by cbam_reference_search with type ORGANIZATION."),
|
|
592
|
+
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
|
+
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 cbam_reference_search with type COUNTRY."),
|
|
595
|
+
locationCode: z.string().trim().min(1).max(100).describe("UN/LOCODE or supported location code."),
|
|
596
|
+
city: z.string().trim().min(1).max(100),
|
|
597
|
+
detailedAddress: z.string().trim().min(1).max(500),
|
|
598
|
+
postalCode: z.string().trim().min(1).max(30),
|
|
599
|
+
postOfficeBox: z.string().trim().min(1).max(100),
|
|
600
|
+
longitude: cbamCoordinate(-180, 180, "longitude"),
|
|
601
|
+
latitude: cbamCoordinate(-90, 90, "latitude"),
|
|
602
|
+
economicActivity: z.string().max(1000).optional(),
|
|
603
|
+
authorizedRepresentative: z.string().max(100).optional(),
|
|
604
|
+
email: z.union([z.string().email().max(100), z.literal("")]).optional(),
|
|
605
|
+
mobile: z.string().max(50).optional(),
|
|
606
|
+
});
|
|
607
|
+
const cbamVerification = z.object({
|
|
608
|
+
corporateName: z.string().max(200).optional(),
|
|
609
|
+
detailedAddress: z.string().max(500).optional(),
|
|
610
|
+
city: z.string().max(100).optional(),
|
|
611
|
+
postalCode: z.string().max(30).optional(),
|
|
612
|
+
country: z.string().max(100).optional(),
|
|
613
|
+
fullName: z.string().max(100).optional(),
|
|
614
|
+
email: z.string().max(100).optional(),
|
|
615
|
+
mobile: z.string().max(50).optional(),
|
|
616
|
+
fax: z.string().max(50).optional(),
|
|
617
|
+
memberState: z.string().max(100).optional(),
|
|
618
|
+
certificationName: z.string().max(200).optional(),
|
|
619
|
+
registrationNo: z.string().max(100).optional(),
|
|
620
|
+
});
|
|
621
|
+
const cbamReportForm = z.object({
|
|
622
|
+
reportName: z.string().trim().min(1).max(200),
|
|
623
|
+
orgId: longId.describe("Organization id for the report. It must be visible to the current user."),
|
|
624
|
+
startDate: cbamDate,
|
|
625
|
+
endDate: cbamDate,
|
|
626
|
+
factoryId: longId.describe("Factory id returned by cbam_reference_search or cbam_factory_save."),
|
|
627
|
+
include: cbamZeroOne.describe("Heat-power cogeneration flag. 0=include heat-power data; 1=do not include it, matching the migrated CBAM convention."),
|
|
628
|
+
verification: cbamVerification.optional().describe("Optional verification organization information. Omit on update to preserve the current verification record."),
|
|
629
|
+
});
|
|
630
|
+
const cbamProcessDefinition = z.object({
|
|
631
|
+
id: longId.optional().describe("Existing process id for update. Omit to create a new process."),
|
|
632
|
+
processName: z.string().trim().min(1).max(200),
|
|
633
|
+
productCategoryId: longId.describe("Product category id returned by cbam_reference_search."),
|
|
634
|
+
preId: z.string().optional().describe("Comma-separated preceding process ids from this report. Use an empty string to clear."),
|
|
635
|
+
elseProduct: z.string().optional().describe("Comma-separated default-product ids for the selected category. Use an empty string to clear."),
|
|
636
|
+
preProcess: z.string().optional().describe("Comma-separated precursor ids from this report. Use an empty string to clear."),
|
|
637
|
+
orderNum: z.number().int().min(1).max(10).optional(),
|
|
638
|
+
productRoute: z.string().optional().describe("Comma-separated default-process route ids returned by cbam_reference_search."),
|
|
639
|
+
includeType: cbamZeroOne.optional().describe("Production-route selection mode: 0=automatic, 1=manual."),
|
|
640
|
+
});
|
|
641
|
+
const cbamPrecursorDefinition = z.object({
|
|
642
|
+
id: longId.optional().describe("Existing precursor id for update. Omit to create a new precursor."),
|
|
643
|
+
preName: z.string().trim().min(1).max(200),
|
|
644
|
+
productCategoryId: longId.describe("Product category id returned by cbam_reference_search."),
|
|
645
|
+
countryCode: z.string().max(100).optional().describe("Country dictionary value returned by cbam_reference_search; omit or clear when not yet known."),
|
|
646
|
+
orderNum: z.number().int().min(1).max(20).optional(),
|
|
647
|
+
productRoute: z.string().optional().describe("Comma-separated default-process route ids returned by cbam_reference_search."),
|
|
648
|
+
});
|
|
649
|
+
const cbamSourceFlow = z.object({
|
|
650
|
+
id: longId.optional().describe("Existing source-flow id for update. Omit to create a new row."),
|
|
651
|
+
productProcessId: longId.describe("Owning process id from the same report."),
|
|
652
|
+
processMethod: cbamCode.describe("Process-method code returned by CBAM_ENUM reference data."),
|
|
653
|
+
sourceType: cbamCode.describe("Source-flow type code returned by CBAM_ENUM reference data."),
|
|
654
|
+
sourceName: z.string().trim().min(1).max(200),
|
|
655
|
+
activityData: nonNegativeNumericValue.optional().describe("Activity amount. Required for sourceType=1 with processMethod 1/2/3 and for sourceType=2 with processMethod 4/5."),
|
|
656
|
+
activityUnit: z.string().max(100).optional().describe("Unit of activityData."),
|
|
657
|
+
lowHeat: nonNegativeNumericValue.optional().describe("Low heating value for sourceType=1 when emissionCoefficientUnit=tCO2/TJ; anode-effect frequency for sourceType=2/processMethod=4; average hourly concentration for sourceType=3."),
|
|
658
|
+
lowHeatUnit: z.string().max(100).optional().describe("Unit of lowHeat when the selected source-flow formula uses one."),
|
|
659
|
+
emissionCoefficient: nonNegativeNumericValue.optional().describe("Emission coefficient for sourceType=1; average anode-effect duration for sourceType=2/processMethod=4; operating hours for sourceType=3."),
|
|
660
|
+
emissionCoefficientUnit: z.string().max(100).optional().describe("Emission-coefficient unit. For sourceType=1, value tCO2/TJ additionally requires lowHeat."),
|
|
661
|
+
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
|
+
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 CBAM formula allows."),
|
|
664
|
+
carbonUnit: z.string().max(100).optional(),
|
|
665
|
+
conversionRateUnit: z.string().max(100).optional(),
|
|
666
|
+
biomassContent: nonNegativeNumericValue.optional().describe("Biomass content for sourceType=1; anode-effect overvoltage AEO for sourceType=2/processMethod=5; biomass share for sourceType=3."),
|
|
667
|
+
biomassContentUnit: z.string().max(100).optional(),
|
|
668
|
+
carbonFossil: nonNegativeNumericValue.optional().describe("Non-zero anode-effect CE denominator, required only for sourceType=2/processMethod=5."),
|
|
669
|
+
carbonBiological: nonNegativeNumericValue.optional().describe("Overvoltage coefficient, required only for sourceType=2/processMethod=5."),
|
|
670
|
+
}).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 cbamHeatPowerData = z.object({
|
|
672
|
+
fuelIn: positiveNumericValue.describe("Fuel input; must be greater than zero."),
|
|
673
|
+
hotPer: positiveNumericValue.describe("Heat allocation parameter; must be greater than zero."),
|
|
674
|
+
elePer: positiveNumericValue.describe("Electricity allocation parameter; must be greater than zero."),
|
|
675
|
+
fuelOut: nonNegativeNumericValue,
|
|
676
|
+
hotOut: nonNegativeNumericValue,
|
|
677
|
+
eleOut: nonNegativeNumericValue,
|
|
678
|
+
smokeOut: nonNegativeNumericValue,
|
|
679
|
+
inputFactor: nonNegativeNumericValue.optional(),
|
|
680
|
+
});
|
|
681
|
+
const cbamActivityRow = z.object({
|
|
682
|
+
relationId: longId.describe("Default-process id or related process id selected from the current item route."),
|
|
683
|
+
isDefault: cbamZeroOne.describe("0=default-process route row; 1=related in-report process row."),
|
|
684
|
+
emission: nonNegativeNumericValue.describe("Activity amount for this route row."),
|
|
685
|
+
});
|
|
686
|
+
const cbamProductAttribution = z.object({
|
|
687
|
+
id: longId.optional().describe("Existing attribution id returned by cbam_report_read. Omit for a new row."),
|
|
688
|
+
emissionElement: cbamCode.describe("Emission-element code returned by CBAM_ENUM reference data."),
|
|
689
|
+
isExists: cbamCode.describe("Whether this emission element is included; use the exact CBAM_ENUM code."),
|
|
690
|
+
inputPower: nonNegativeNumericValue.optional(),
|
|
691
|
+
inputFactor: nonNegativeNumericValue.optional(),
|
|
692
|
+
outPower: nonNegativeNumericValue.optional(),
|
|
693
|
+
outFactor: nonNegativeNumericValue.optional(),
|
|
694
|
+
emissionSource: cbamCode.optional(),
|
|
695
|
+
eleSource: z.string().max(100).optional(),
|
|
696
|
+
eleChoose: cbamCode.optional(),
|
|
697
|
+
defaultCnId: longId.optional(),
|
|
698
|
+
cnCode: z.string().max(100).optional(),
|
|
699
|
+
});
|
|
700
|
+
const cbamElectricityCalculator = z.object({
|
|
701
|
+
id: longId.optional(),
|
|
702
|
+
eleValue: nonNegativeNumericValue,
|
|
703
|
+
coefficient: nonNegativeNumericValue,
|
|
704
|
+
});
|
|
705
|
+
const cbamProcessProductData = z.object({
|
|
706
|
+
id: longId.describe("Existing process id from the same report."),
|
|
707
|
+
totalVolume: nonNegativeNumericValue.describe("Total output. Must satisfy totalVolume - salesVolume - nonProduct - sum(processList emission where isDefault=1) = 0 at six-decimal precision."),
|
|
708
|
+
salesVolume: nonNegativeNumericValue.describe("Sold output used in the process balance equation."),
|
|
709
|
+
nonProduct: nonNegativeNumericValue.optional().describe("Non-product output used in the process balance equation; omit to treat it as zero."),
|
|
710
|
+
processList: z.array(cbamActivityRow).max(100).optional().describe("Activity route rows. Rows with isDefault=1 are subtracted in the process balance equation."),
|
|
711
|
+
productAttributionList: z.array(cbamProductAttribution).max(100).optional(),
|
|
712
|
+
eleCalculatorList: z.array(cbamElectricityCalculator).max(100).optional(),
|
|
713
|
+
}).describe("Complete product activity/emission data for one existing process. The backend rejects an unbalanced item.");
|
|
714
|
+
const cbamPrecursorProductData = z.object({
|
|
715
|
+
id: longId.describe("Existing precursor id from the same report."),
|
|
716
|
+
purchaseVolume: nonNegativeNumericValue.optional(),
|
|
717
|
+
nonProduct: nonNegativeNumericValue.optional().describe("Non-product amount subtracted in the precursor balance equation."),
|
|
718
|
+
defaultReason: cbamCode.optional(),
|
|
719
|
+
isDefault: cbamZeroOne.optional(),
|
|
720
|
+
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."),
|
|
721
|
+
productAttributionList: z.array(cbamProductAttribution).max(100).optional(),
|
|
722
|
+
}).describe("Complete activity/emission data for one existing precursor. The backend rejects an unbalanced item.");
|
|
723
|
+
const cbamSaleProduct = z.object({
|
|
724
|
+
id: longId.optional().describe("Existing sale-product id for update. Omit to create."),
|
|
725
|
+
cnCode: z.string().trim().min(1).max(100).describe("CN code valid for the selected process product category."),
|
|
726
|
+
processId: longId.describe("Owning process id from the same report."),
|
|
727
|
+
productName: z.string().trim().min(1).max(200),
|
|
728
|
+
reducing: cbamCode.optional(),
|
|
729
|
+
steelCode: z.string().max(100).optional(),
|
|
730
|
+
mnPer: nonNegativeNumericValue.optional(),
|
|
731
|
+
crPer: nonNegativeNumericValue.optional(),
|
|
732
|
+
niPer: nonNegativeNumericValue.optional(),
|
|
733
|
+
alloyPer: nonNegativeNumericValue.optional(),
|
|
734
|
+
cPer: nonNegativeNumericValue.optional(),
|
|
735
|
+
materialPer: nonNegativeNumericValue.optional(),
|
|
736
|
+
steelScrap: nonNegativeNumericValue.optional(),
|
|
737
|
+
wasteMaterial: nonNegativeNumericValue.optional(),
|
|
738
|
+
alUse: nonNegativeNumericValue.optional(),
|
|
739
|
+
nonAl: nonNegativeNumericValue.optional(),
|
|
740
|
+
clinker: nonNegativeNumericValue.describe("Cement clinker value required by the migrated CBAM form contract."),
|
|
741
|
+
calcine: cbamCode.describe("Calcination flag code required by the migrated CBAM form contract."),
|
|
742
|
+
solution: nonNegativeNumericValue.describe("Aqueous-solution concentration required by the migrated CBAM form contract."),
|
|
743
|
+
nitric: nonNegativeNumericValue.optional(),
|
|
744
|
+
urea: nonNegativeNumericValue.optional(),
|
|
745
|
+
nitrogen: nonNegativeNumericValue.optional(),
|
|
746
|
+
ammonium: nonNegativeNumericValue.optional(),
|
|
747
|
+
noPer: nonNegativeNumericValue.optional(),
|
|
748
|
+
urPer: nonNegativeNumericValue.optional(),
|
|
749
|
+
organic: nonNegativeNumericValue.optional(),
|
|
750
|
+
});
|
|
751
|
+
const cbamCarbonTax = z.object({
|
|
752
|
+
id: longId.optional().describe("Existing carbon-tax row id for update. Omit to create."),
|
|
753
|
+
saleProductId: longId.describe("Sale-product id from the same report."),
|
|
754
|
+
reportSelected: cbamZeroOne.optional(),
|
|
755
|
+
emissionValueType: cbamCode.optional(),
|
|
756
|
+
emissionSourceType: cbamCode.optional(),
|
|
757
|
+
emissionSourceSaleProductId: longId.optional(),
|
|
758
|
+
emissionSourceDefaultCnId: longId.optional(),
|
|
759
|
+
emissionSourceYear: z.number().int().min(1900).max(9999).optional(),
|
|
760
|
+
productBenchmarkId: longId.optional(),
|
|
761
|
+
productBenchmarkType: cbamCode.optional(),
|
|
762
|
+
cbamAdjustmentFactor: nonNegativeNumericValue.optional(),
|
|
763
|
+
paidCarbonPrice: nonNegativeNumericValue.optional(),
|
|
764
|
+
taxType: cbamCode.optional(),
|
|
765
|
+
emissionPer: nonNegativeNumericValue.optional(),
|
|
766
|
+
currencyType: z.string().trim().min(1).max(100).describe("Currency dictionary value returned by cbam_reference_search."),
|
|
767
|
+
taxValue: nonNegativeNumericValue.optional(),
|
|
768
|
+
offsetMethod: cbamCode.optional(),
|
|
769
|
+
offsetPer: nonNegativeNumericValue.optional(),
|
|
770
|
+
offsetPrice: nonNegativeNumericValue.optional(),
|
|
771
|
+
});
|
|
772
|
+
const cbamDataQuality = z.object({
|
|
773
|
+
generalInformation: cbamCode.optional(),
|
|
774
|
+
defaultReason: cbamCode.optional(),
|
|
775
|
+
qualityAssurance: cbamCode.optional(),
|
|
776
|
+
carbonPrice: z.string().max(5000).optional(),
|
|
777
|
+
supplement: z.string().max(5000).optional(),
|
|
778
|
+
});
|
|
519
779
|
export const schemas = {
|
|
520
780
|
session_carbon_objects: z.object({
|
|
521
781
|
sessionId,
|
|
522
782
|
module: z
|
|
523
|
-
.enum(["all", "footprint3", "enterprise"])
|
|
783
|
+
.enum(["all", "footprint3", "enterprise", "cbam"])
|
|
524
784
|
.optional()
|
|
525
|
-
.describe("Optional module filter. Omit it or use all to return
|
|
785
|
+
.describe("Optional module filter. Omit it or use all to return product-carbon, enterprise-carbon, and CBAM objects."),
|
|
786
|
+
}),
|
|
787
|
+
cbam_reference_search: z.object({
|
|
788
|
+
...cbamReadFields,
|
|
789
|
+
types: z.array(cbamReferenceType).min(1).max(12)
|
|
790
|
+
.describe("Only the reference-data families needed for the current step. CARBON_TAX_CANDIDATE additionally requires reportId."),
|
|
791
|
+
keyword: z.string().trim().max(200).optional(),
|
|
792
|
+
orgId: longId.optional(),
|
|
793
|
+
reportId: longId.optional(),
|
|
794
|
+
limit: z.number().int().min(1).max(200).optional(),
|
|
795
|
+
pageNum: z.number().int().min(1).optional(),
|
|
796
|
+
pageSize: z.number().int().min(1).max(200).optional(),
|
|
797
|
+
}),
|
|
798
|
+
cbam_report_search: z.object({
|
|
799
|
+
...cbamReadFields,
|
|
800
|
+
reportName: z.string().trim().max(200).optional(),
|
|
801
|
+
orgId: longId.optional(),
|
|
802
|
+
factoryId: longId.optional(),
|
|
803
|
+
year: z.number().int().min(1900).max(9999).optional(),
|
|
804
|
+
pageNum: z.number().int().min(1).optional(),
|
|
805
|
+
pageSize: z.number().int().min(1).max(100).optional(),
|
|
806
|
+
}),
|
|
807
|
+
cbam_report_read: z.object({
|
|
808
|
+
...cbamReadFields,
|
|
809
|
+
reportId: longId.describe("Exact CBAM report id returned by cbam_report_search, cbam_report_save, or session_carbon_objects."),
|
|
810
|
+
view: z.enum(["snapshot", "section", "item", "result", "readiness", "carbon_tax_status"])
|
|
811
|
+
.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: cbamSection.optional().describe("Required only when view=section."),
|
|
813
|
+
itemType: cbamItemType.optional().describe("Required only when view=item."),
|
|
814
|
+
itemId: longId.optional().describe("Required only when view=item; must belong to reportId."),
|
|
815
|
+
}),
|
|
816
|
+
cbam_factory_read: z.object({
|
|
817
|
+
...cbamReadFields,
|
|
818
|
+
factoryId: longId.describe("Exact factory id returned by cbam_reference_search or cbam_factory_save."),
|
|
819
|
+
}),
|
|
820
|
+
cbam_factory_save: z.object({
|
|
821
|
+
...cbamConfirmedWriteFields,
|
|
822
|
+
action: z.enum(["create", "update"]),
|
|
823
|
+
factoryId: longId.optional().describe("Required for action=update and omitted for action=create."),
|
|
824
|
+
factory: cbamFactoryForm.describe("Complete factory form. For update, first call cbam_factory_read and preserve unchanged fields and orgId."),
|
|
825
|
+
}),
|
|
826
|
+
cbam_report_save: z.object({
|
|
827
|
+
...cbamWriteFields,
|
|
828
|
+
action: z.enum(["create", "update"]),
|
|
829
|
+
reportId: longId.optional().describe("Required for action=update and omitted for action=create."),
|
|
830
|
+
report: cbamReportForm.describe("Complete CBAM general-information form."),
|
|
831
|
+
}),
|
|
832
|
+
cbam_process_manage: z.object({
|
|
833
|
+
...cbamConfirmedWriteFields,
|
|
834
|
+
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(cbamProcessDefinition).min(1).max(10).optional()
|
|
837
|
+
.describe("Required only for action=save. The report can contain at most 10 processes."),
|
|
838
|
+
ids: z.array(longId).min(1).max(10).optional()
|
|
839
|
+
.describe("Required for delete/reorder. Reorder must contain every report process exactly once in target order."),
|
|
840
|
+
}),
|
|
841
|
+
cbam_precursor_manage: z.object({
|
|
842
|
+
...cbamConfirmedWriteFields,
|
|
843
|
+
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(cbamPrecursorDefinition).min(1).max(20).optional()
|
|
846
|
+
.describe("Required only for action=save. The report can contain at most 20 manually entered precursors."),
|
|
847
|
+
ids: z.array(longId).min(1).max(20).optional().describe("Required only for action=delete."),
|
|
848
|
+
}),
|
|
849
|
+
cbam_source_flow_manage: z.object({
|
|
850
|
+
...cbamConfirmedWriteFields,
|
|
851
|
+
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(cbamSourceFlow).min(1).max(200).optional().describe("Required only for action=save."),
|
|
854
|
+
ids: z.array(longId).min(1).max(100).optional().describe("Required only for action=delete."),
|
|
855
|
+
}),
|
|
856
|
+
cbam_heat_power_update: z.object({
|
|
857
|
+
...cbamWriteFields,
|
|
858
|
+
reportId: longId,
|
|
859
|
+
data: cbamHeatPowerData.describe("Complete heat-power input form. The backend calculates outPower and outFactor; never submit calculated outputs."),
|
|
860
|
+
}),
|
|
861
|
+
cbam_product_data_update: z.object({
|
|
862
|
+
...cbamWriteFields,
|
|
863
|
+
reportId: longId,
|
|
864
|
+
dataType: z.enum(["process", "precursor"])
|
|
865
|
+
.describe("Select process for self-produced process activity data or precursor for purchased-precursor activity/emission data."),
|
|
866
|
+
items: z.array(z.union([cbamProcessProductData, cbamPrecursorProductData])).min(1).max(100),
|
|
867
|
+
}),
|
|
868
|
+
cbam_sale_product_manage: z.object({
|
|
869
|
+
...cbamConfirmedWriteFields,
|
|
870
|
+
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(cbamSaleProduct).min(1).max(100).optional().describe("Required only for action=save."),
|
|
873
|
+
ids: z.array(longId).min(1).max(100).optional().describe("Required only for action=delete."),
|
|
874
|
+
}),
|
|
875
|
+
cbam_carbon_tax_manage: z.object({
|
|
876
|
+
...cbamConfirmedWriteFields,
|
|
877
|
+
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(cbamCarbonTax).min(1).max(100).optional().describe("Required only for action=save."),
|
|
880
|
+
ids: z.array(longId).min(1).max(100).optional().describe("Required only for action=delete."),
|
|
881
|
+
}),
|
|
882
|
+
cbam_data_quality_update: z.object({
|
|
883
|
+
...cbamWriteFields,
|
|
884
|
+
reportId: longId,
|
|
885
|
+
data: cbamDataQuality.describe("Complete data-quality form. Read DATA_QUALITY first and preserve fields the user did not change."),
|
|
886
|
+
}),
|
|
887
|
+
cbam_report_generate: z.object({
|
|
888
|
+
...cbamConfirmedWriteFields,
|
|
889
|
+
reportId: longId.describe("CBAM report id to generate. Basic general information is sufficient to start; readiness reports optional missing sections separately."),
|
|
890
|
+
}),
|
|
891
|
+
cbam_report_generation_status: z.object({
|
|
892
|
+
...cbamReadFields,
|
|
893
|
+
reportId: longId,
|
|
894
|
+
generationId: longId.describe("Generation task id returned by cbam_report_generate."),
|
|
526
895
|
}),
|
|
527
896
|
user_memory_recall: z.object({
|
|
528
897
|
sessionId,
|
|
@@ -975,6 +1344,22 @@ export const schemas = {
|
|
|
975
1344
|
schemas.enterprise_report_regenerate = schemas.enterprise_report_generate;
|
|
976
1345
|
export const exposedToolNames = [
|
|
977
1346
|
"session_carbon_objects",
|
|
1347
|
+
"cbam_reference_search",
|
|
1348
|
+
"cbam_report_search",
|
|
1349
|
+
"cbam_report_read",
|
|
1350
|
+
"cbam_factory_read",
|
|
1351
|
+
"cbam_factory_save",
|
|
1352
|
+
"cbam_report_save",
|
|
1353
|
+
"cbam_process_manage",
|
|
1354
|
+
"cbam_precursor_manage",
|
|
1355
|
+
"cbam_source_flow_manage",
|
|
1356
|
+
"cbam_heat_power_update",
|
|
1357
|
+
"cbam_product_data_update",
|
|
1358
|
+
"cbam_sale_product_manage",
|
|
1359
|
+
"cbam_carbon_tax_manage",
|
|
1360
|
+
"cbam_data_quality_update",
|
|
1361
|
+
"cbam_report_generate",
|
|
1362
|
+
"cbam_report_generation_status",
|
|
978
1363
|
"user_memory_recall",
|
|
979
1364
|
"user_memory_get",
|
|
980
1365
|
"user_memory_upsert",
|
|
@@ -1031,7 +1416,23 @@ export const exposedToolNames = [
|
|
|
1031
1416
|
"enterprise_emission_batch_delete",
|
|
1032
1417
|
];
|
|
1033
1418
|
export const descriptions = {
|
|
1034
|
-
session_carbon_objects: "Recover
|
|
1419
|
+
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.",
|
|
1420
|
+
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.",
|
|
1421
|
+
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.",
|
|
1422
|
+
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.",
|
|
1423
|
+
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.",
|
|
1424
|
+
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 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
|
+
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.",
|
|
1426
|
+
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 uses WAIT_CONFIRM and must repeat the identical request with returned pendingActionId after confirmation. Requires idempotencyKey; MCP never automatically retries.",
|
|
1427
|
+
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 uses WAIT_CONFIRM. Requires idempotencyKey; MCP never automatically retries.",
|
|
1428
|
+
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 uses WAIT_CONFIRM. Requires idempotencyKey.",
|
|
1429
|
+
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.",
|
|
1430
|
+
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.",
|
|
1431
|
+
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 uses WAIT_CONFIRM. Requires idempotencyKey.",
|
|
1432
|
+
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 use WAIT_CONFIRM; after calculate succeeds, poll cbam_report_read with view=carbon_tax_status. Requires idempotencyKey and is never automatically retried.",
|
|
1433
|
+
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.",
|
|
1434
|
+
cbam_report_generate: "Start backend generation of the selected CBAM report file. 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. This costly asynchronous action uses WAIT_CONFIRM. After confirmation repeat the identical payload/idempotencyKey with confirmed=true and pendingActionId, then poll cbam_report_generation_status using returned generationId. Timeout/network/5xx failures are not automatically retried.",
|
|
1435
|
+
cbam_report_generation_status: "Poll one CBAM report-generation task using the exact reportId and generationId returned by cbam_report_generate. Returns RUNNING, COMPLETED, or FAILED plus the generated download record/path when available. Read-only.",
|
|
1035
1436
|
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.",
|
|
1036
1437
|
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.",
|
|
1037
1438
|
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.",
|
|
@@ -1100,6 +1501,135 @@ export const toolRoutes = {
|
|
|
1100
1501
|
method: "POST",
|
|
1101
1502
|
path: apipath.SessionBusinessRefs(),
|
|
1102
1503
|
bodyKind: "sessionContext",
|
|
1504
|
+
responseKind: "sessionCarbonObjects",
|
|
1505
|
+
},
|
|
1506
|
+
cbam_reference_search: {
|
|
1507
|
+
method: "POST",
|
|
1508
|
+
path: apipath.CbamReferenceSearch(),
|
|
1509
|
+
bodyKind: "cbam",
|
|
1510
|
+
},
|
|
1511
|
+
cbam_report_search: {
|
|
1512
|
+
method: "POST",
|
|
1513
|
+
path: apipath.CbamReportSearch(),
|
|
1514
|
+
bodyKind: "cbam",
|
|
1515
|
+
},
|
|
1516
|
+
cbam_report_read: {
|
|
1517
|
+
method: "POST",
|
|
1518
|
+
path: (args) => {
|
|
1519
|
+
if (args.view === "section")
|
|
1520
|
+
return apipath.CbamSectionSnapshot();
|
|
1521
|
+
if (args.view === "item")
|
|
1522
|
+
return apipath.CbamItemDetail();
|
|
1523
|
+
if (args.view === "result")
|
|
1524
|
+
return apipath.CbamResultSummary();
|
|
1525
|
+
if (args.view === "readiness")
|
|
1526
|
+
return apipath.CbamReportReadiness();
|
|
1527
|
+
if (args.view === "carbon_tax_status")
|
|
1528
|
+
return apipath.CbamCarbonTaxStatus();
|
|
1529
|
+
return apipath.CbamReportSnapshot();
|
|
1530
|
+
},
|
|
1531
|
+
bodyKind: "cbam",
|
|
1532
|
+
},
|
|
1533
|
+
cbam_factory_read: {
|
|
1534
|
+
method: "POST",
|
|
1535
|
+
path: apipath.CbamFactoryDetail(),
|
|
1536
|
+
bodyKind: "cbam",
|
|
1537
|
+
},
|
|
1538
|
+
cbam_factory_save: {
|
|
1539
|
+
method: "POST",
|
|
1540
|
+
path: (args) => args.action === "update"
|
|
1541
|
+
? apipath.CbamFactoryUpdate()
|
|
1542
|
+
: apipath.CbamFactoryCreate(),
|
|
1543
|
+
bodyKind: "cbam",
|
|
1544
|
+
maxRetries: 0,
|
|
1545
|
+
},
|
|
1546
|
+
cbam_report_save: {
|
|
1547
|
+
method: "POST",
|
|
1548
|
+
path: (args) => args.action === "update"
|
|
1549
|
+
? apipath.CbamReportUpdate()
|
|
1550
|
+
: apipath.CbamReportCreate(),
|
|
1551
|
+
bodyKind: "cbam",
|
|
1552
|
+
maxRetries: 0,
|
|
1553
|
+
},
|
|
1554
|
+
cbam_process_manage: {
|
|
1555
|
+
method: "POST",
|
|
1556
|
+
path: (args) => {
|
|
1557
|
+
if (args.action === "delete")
|
|
1558
|
+
return apipath.CbamProcessBatchDelete();
|
|
1559
|
+
if (args.action === "reorder")
|
|
1560
|
+
return apipath.CbamProcessReorder();
|
|
1561
|
+
return apipath.CbamProcessBatchSave();
|
|
1562
|
+
},
|
|
1563
|
+
bodyKind: "cbam",
|
|
1564
|
+
maxRetries: 0,
|
|
1565
|
+
},
|
|
1566
|
+
cbam_precursor_manage: {
|
|
1567
|
+
method: "POST",
|
|
1568
|
+
path: (args) => args.action === "delete"
|
|
1569
|
+
? apipath.CbamPrecursorBatchDelete()
|
|
1570
|
+
: apipath.CbamPrecursorBatchSave(),
|
|
1571
|
+
bodyKind: "cbam",
|
|
1572
|
+
maxRetries: 0,
|
|
1573
|
+
},
|
|
1574
|
+
cbam_source_flow_manage: {
|
|
1575
|
+
method: "POST",
|
|
1576
|
+
path: (args) => args.action === "delete"
|
|
1577
|
+
? apipath.CbamSourceFlowBatchDelete()
|
|
1578
|
+
: apipath.CbamSourceFlowBatchSave(),
|
|
1579
|
+
bodyKind: "cbam",
|
|
1580
|
+
maxRetries: 0,
|
|
1581
|
+
},
|
|
1582
|
+
cbam_heat_power_update: {
|
|
1583
|
+
method: "POST",
|
|
1584
|
+
path: apipath.CbamHeatPowerUpdate(),
|
|
1585
|
+
bodyKind: "cbam",
|
|
1586
|
+
maxRetries: 0,
|
|
1587
|
+
},
|
|
1588
|
+
cbam_product_data_update: {
|
|
1589
|
+
method: "POST",
|
|
1590
|
+
path: (args) => args.dataType === "precursor"
|
|
1591
|
+
? apipath.CbamPrecursorProductBatchUpdate()
|
|
1592
|
+
: apipath.CbamProcessProductBatchUpdate(),
|
|
1593
|
+
bodyKind: "cbam",
|
|
1594
|
+
maxRetries: 0,
|
|
1595
|
+
},
|
|
1596
|
+
cbam_sale_product_manage: {
|
|
1597
|
+
method: "POST",
|
|
1598
|
+
path: (args) => args.action === "delete"
|
|
1599
|
+
? apipath.CbamSaleProductBatchDelete()
|
|
1600
|
+
: apipath.CbamSaleProductBatchSave(),
|
|
1601
|
+
bodyKind: "cbam",
|
|
1602
|
+
maxRetries: 0,
|
|
1603
|
+
},
|
|
1604
|
+
cbam_carbon_tax_manage: {
|
|
1605
|
+
method: "POST",
|
|
1606
|
+
path: (args) => {
|
|
1607
|
+
if (args.action === "delete")
|
|
1608
|
+
return apipath.CbamCarbonTaxBatchDelete();
|
|
1609
|
+
if (args.action === "calculate")
|
|
1610
|
+
return apipath.CbamCarbonTaxCalculate();
|
|
1611
|
+
return apipath.CbamCarbonTaxBatchSave();
|
|
1612
|
+
},
|
|
1613
|
+
bodyKind: "cbam",
|
|
1614
|
+
maxRetries: 0,
|
|
1615
|
+
},
|
|
1616
|
+
cbam_data_quality_update: {
|
|
1617
|
+
method: "POST",
|
|
1618
|
+
path: apipath.CbamDataQualityUpdate(),
|
|
1619
|
+
bodyKind: "cbam",
|
|
1620
|
+
maxRetries: 0,
|
|
1621
|
+
},
|
|
1622
|
+
cbam_report_generate: {
|
|
1623
|
+
method: "POST",
|
|
1624
|
+
path: apipath.CbamReportGenerate(),
|
|
1625
|
+
bodyKind: "cbam",
|
|
1626
|
+
timeoutSeconds: 120,
|
|
1627
|
+
maxRetries: 0,
|
|
1628
|
+
},
|
|
1629
|
+
cbam_report_generation_status: {
|
|
1630
|
+
method: "POST",
|
|
1631
|
+
path: apipath.CbamReportGenerationStatus(),
|
|
1632
|
+
bodyKind: "cbam",
|
|
1103
1633
|
},
|
|
1104
1634
|
user_memory_recall: {
|
|
1105
1635
|
method: "POST",
|
|
@@ -1413,8 +1943,51 @@ export const toolRoutes = {
|
|
|
1413
1943
|
},
|
|
1414
1944
|
};
|
|
1415
1945
|
export function buildBody(route, args) {
|
|
1946
|
+
if (route.bodyKind === "cbam") {
|
|
1947
|
+
const body = { ...args };
|
|
1948
|
+
const action = body.action;
|
|
1949
|
+
const view = body.view;
|
|
1950
|
+
delete body.action;
|
|
1951
|
+
delete body.view;
|
|
1952
|
+
delete body.dataType;
|
|
1953
|
+
if (view === "section") {
|
|
1954
|
+
delete body.itemType;
|
|
1955
|
+
delete body.itemId;
|
|
1956
|
+
}
|
|
1957
|
+
else if (view === "item") {
|
|
1958
|
+
delete body.section;
|
|
1959
|
+
}
|
|
1960
|
+
else if (view !== undefined) {
|
|
1961
|
+
delete body.section;
|
|
1962
|
+
delete body.itemType;
|
|
1963
|
+
delete body.itemId;
|
|
1964
|
+
}
|
|
1965
|
+
if (action === "save") {
|
|
1966
|
+
delete body.ids;
|
|
1967
|
+
}
|
|
1968
|
+
else if (action === "delete" || action === "reorder") {
|
|
1969
|
+
delete body.items;
|
|
1970
|
+
}
|
|
1971
|
+
else if (action === "calculate") {
|
|
1972
|
+
delete body.items;
|
|
1973
|
+
delete body.ids;
|
|
1974
|
+
}
|
|
1975
|
+
const confirmationRequired = route === toolRoutes.cbam_factory_save
|
|
1976
|
+
|| route === toolRoutes.cbam_report_generate
|
|
1977
|
+
|| action === "delete"
|
|
1978
|
+
|| action === "calculate";
|
|
1979
|
+
if (!confirmationRequired) {
|
|
1980
|
+
delete body.confirmed;
|
|
1981
|
+
delete body.pendingActionId;
|
|
1982
|
+
}
|
|
1983
|
+
return normalizeCbamCodes(normalizeIds(pickDefined(body)));
|
|
1984
|
+
}
|
|
1416
1985
|
if (route.bodyKind === "sessionContext") {
|
|
1417
|
-
return pickDefined({
|
|
1986
|
+
return pickDefined({
|
|
1987
|
+
sessionId: args.sessionId,
|
|
1988
|
+
// The Agent-facing module is CBAM; the existing Java contract still uses cbam2.
|
|
1989
|
+
module: args.module === "cbam" ? "cbam2" : args.module,
|
|
1990
|
+
});
|
|
1418
1991
|
}
|
|
1419
1992
|
if (route.bodyKind === "projectRead") {
|
|
1420
1993
|
const projectTaskId = typeof args.projectTaskId === "string"
|
|
@@ -1660,6 +2233,50 @@ function normalizeEnterpriseEmissionSource(source, gasListField) {
|
|
|
1660
2233
|
function normalizeNumericCode(value) {
|
|
1661
2234
|
return typeof value === "string" && /^\d+$/.test(value) ? Number(value) : value;
|
|
1662
2235
|
}
|
|
2236
|
+
const cbamNumericCodeFields = new Set([
|
|
2237
|
+
"include",
|
|
2238
|
+
"includeType",
|
|
2239
|
+
"processMethod",
|
|
2240
|
+
"sourceType",
|
|
2241
|
+
"isDefault",
|
|
2242
|
+
"emissionElement",
|
|
2243
|
+
"isExists",
|
|
2244
|
+
"emissionSource",
|
|
2245
|
+
"eleChoose",
|
|
2246
|
+
"reducing",
|
|
2247
|
+
"calcine",
|
|
2248
|
+
"reportSelected",
|
|
2249
|
+
"emissionValueType",
|
|
2250
|
+
"emissionSourceType",
|
|
2251
|
+
"emissionSourceYear",
|
|
2252
|
+
"productBenchmarkType",
|
|
2253
|
+
"taxType",
|
|
2254
|
+
"offsetMethod",
|
|
2255
|
+
"generalInformation",
|
|
2256
|
+
"defaultReason",
|
|
2257
|
+
"qualityAssurance",
|
|
2258
|
+
"orderNum",
|
|
2259
|
+
]);
|
|
2260
|
+
const cbamGenericIdFields = new Set(["id"]);
|
|
2261
|
+
function normalizeCbamCodes(value) {
|
|
2262
|
+
if (Array.isArray(value))
|
|
2263
|
+
return value.map(normalizeCbamCodes);
|
|
2264
|
+
if (!value || typeof value !== "object")
|
|
2265
|
+
return value;
|
|
2266
|
+
const result = {};
|
|
2267
|
+
for (const [key, childValue] of Object.entries(value)) {
|
|
2268
|
+
if (cbamNumericCodeFields.has(key)) {
|
|
2269
|
+
result[key] = normalizeNumericCode(childValue);
|
|
2270
|
+
}
|
|
2271
|
+
else if (cbamGenericIdFields.has(key) && typeof childValue === "string" && /^\d+$/.test(childValue)) {
|
|
2272
|
+
result[key] = normalizeNumericId(childValue);
|
|
2273
|
+
}
|
|
2274
|
+
else {
|
|
2275
|
+
result[key] = normalizeCbamCodes(childValue);
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
2278
|
+
return result;
|
|
2279
|
+
}
|
|
1663
2280
|
function normalizeDecimalValue(value) {
|
|
1664
2281
|
if (typeof value !== "string")
|
|
1665
2282
|
return value;
|
|
@@ -1669,6 +2286,10 @@ function normalizeDecimalValue(value) {
|
|
|
1669
2286
|
return Number(normalized);
|
|
1670
2287
|
}
|
|
1671
2288
|
export function validateToolArgs(name, args) {
|
|
2289
|
+
if (name.startsWith("cbam_")) {
|
|
2290
|
+
validateCbamArgs(name, args);
|
|
2291
|
+
return;
|
|
2292
|
+
}
|
|
1672
2293
|
if (name === "enterprise_emission_batch_save" && Array.isArray(args.orgList)) {
|
|
1673
2294
|
validateEnterpriseEmissionSaveArgs(args.orgList);
|
|
1674
2295
|
return;
|
|
@@ -1677,6 +2298,247 @@ export function validateToolArgs(name, args) {
|
|
|
1677
2298
|
validateEnterpriseEmissionUpdateArgs(args.computationList);
|
|
1678
2299
|
}
|
|
1679
2300
|
}
|
|
2301
|
+
function validateCbamArgs(name, args) {
|
|
2302
|
+
if (name === "cbam_reference_search") {
|
|
2303
|
+
const types = Array.isArray(args.types) ? args.types.map(String) : [];
|
|
2304
|
+
requireUniqueValues(types, "types");
|
|
2305
|
+
if (types.includes("CARBON_TAX_CANDIDATE") && args.reportId === undefined) {
|
|
2306
|
+
cbamInputError("REPORT_ID_REQUIRED", "reportId", "reportId is required when types contains CARBON_TAX_CANDIDATE");
|
|
2307
|
+
}
|
|
2308
|
+
return;
|
|
2309
|
+
}
|
|
2310
|
+
if (name === "cbam_report_read") {
|
|
2311
|
+
if (args.view === "section" && args.section === undefined) {
|
|
2312
|
+
cbamInputError("SECTION_REQUIRED", "section", "section is required when view=section");
|
|
2313
|
+
}
|
|
2314
|
+
if (args.view === "item") {
|
|
2315
|
+
if (args.itemType === undefined)
|
|
2316
|
+
cbamInputError("ITEM_TYPE_REQUIRED", "itemType", "itemType is required when view=item");
|
|
2317
|
+
if (args.itemId === undefined)
|
|
2318
|
+
cbamInputError("ITEM_ID_REQUIRED", "itemId", "itemId is required when view=item");
|
|
2319
|
+
}
|
|
2320
|
+
return;
|
|
2321
|
+
}
|
|
2322
|
+
if (name === "cbam_factory_save") {
|
|
2323
|
+
validateCreateUpdateId(args, "factoryId");
|
|
2324
|
+
validateCbamConfirmation(args, true);
|
|
2325
|
+
return;
|
|
2326
|
+
}
|
|
2327
|
+
if (name === "cbam_report_save") {
|
|
2328
|
+
validateCreateUpdateId(args, "reportId");
|
|
2329
|
+
const report = args.report;
|
|
2330
|
+
if (report)
|
|
2331
|
+
validateCbamDateRange(report.startDate, report.endDate);
|
|
2332
|
+
return;
|
|
2333
|
+
}
|
|
2334
|
+
if (name === "cbam_process_manage") {
|
|
2335
|
+
validateCbamActionPayload(args, ["save", "delete", "reorder"]);
|
|
2336
|
+
if (args.action === "reorder" || args.action === "delete")
|
|
2337
|
+
requireUniqueIdArray(args.ids, "ids");
|
|
2338
|
+
if (args.action === "save")
|
|
2339
|
+
requireUniqueItemIds(args.items);
|
|
2340
|
+
validateCbamConfirmation(args, args.action === "delete");
|
|
2341
|
+
return;
|
|
2342
|
+
}
|
|
2343
|
+
if (["cbam_precursor_manage", "cbam_source_flow_manage", "cbam_sale_product_manage"].includes(name)) {
|
|
2344
|
+
validateCbamActionPayload(args, ["save", "delete"]);
|
|
2345
|
+
if (args.action === "delete")
|
|
2346
|
+
requireUniqueIdArray(args.ids, "ids");
|
|
2347
|
+
if (args.action === "save")
|
|
2348
|
+
requireUniqueItemIds(args.items);
|
|
2349
|
+
if (name === "cbam_source_flow_manage" && args.action === "save") {
|
|
2350
|
+
validateCbamSourceFlows(args.items);
|
|
2351
|
+
}
|
|
2352
|
+
validateCbamConfirmation(args, args.action === "delete");
|
|
2353
|
+
return;
|
|
2354
|
+
}
|
|
2355
|
+
if (name === "cbam_carbon_tax_manage") {
|
|
2356
|
+
validateCbamActionPayload(args, ["save", "delete", "calculate"]);
|
|
2357
|
+
if (args.action === "delete")
|
|
2358
|
+
requireUniqueIdArray(args.ids, "ids");
|
|
2359
|
+
if (args.action === "save")
|
|
2360
|
+
requireUniqueItemIds(args.items);
|
|
2361
|
+
validateCbamConfirmation(args, args.action === "delete" || args.action === "calculate");
|
|
2362
|
+
return;
|
|
2363
|
+
}
|
|
2364
|
+
if (name === "cbam_product_data_update") {
|
|
2365
|
+
const itemSchema = args.dataType === "precursor"
|
|
2366
|
+
? cbamPrecursorProductData
|
|
2367
|
+
: cbamProcessProductData;
|
|
2368
|
+
const items = Array.isArray(args.items) ? args.items : [];
|
|
2369
|
+
for (let index = 0; index < items.length; index++) {
|
|
2370
|
+
if (!itemSchema.safeParse(items[index]).success) {
|
|
2371
|
+
cbamInputError("PRODUCT_DATA_TYPE_MISMATCH", `items[${index}]`, `item does not match dataType=${String(args.dataType)}`);
|
|
2372
|
+
}
|
|
2373
|
+
}
|
|
2374
|
+
requireUniqueItemIds(items);
|
|
2375
|
+
return;
|
|
2376
|
+
}
|
|
2377
|
+
if (name === "cbam_report_generate") {
|
|
2378
|
+
validateCbamConfirmation(args, true);
|
|
2379
|
+
}
|
|
2380
|
+
}
|
|
2381
|
+
function validateCreateUpdateId(args, idField) {
|
|
2382
|
+
if (args.action === "update" && args[idField] === undefined) {
|
|
2383
|
+
cbamInputError("ID_REQUIRED", idField, `${idField} is required when action=update`);
|
|
2384
|
+
}
|
|
2385
|
+
if (args.action === "create" && args[idField] !== undefined) {
|
|
2386
|
+
cbamInputError("ID_NOT_ALLOWED", idField, `${idField} must be omitted when action=create`);
|
|
2387
|
+
}
|
|
2388
|
+
}
|
|
2389
|
+
function validateCbamActionPayload(args, supported) {
|
|
2390
|
+
const action = String(args.action || "");
|
|
2391
|
+
if (!supported.includes(action))
|
|
2392
|
+
cbamInputError("INVALID_ACTION", "action", `unsupported action: ${action}`);
|
|
2393
|
+
if (action === "save") {
|
|
2394
|
+
requireNonEmptyArray(args.items, "items");
|
|
2395
|
+
if (args.ids !== undefined)
|
|
2396
|
+
cbamInputError("UNEXPECTED_IDS", "ids", "ids must be omitted when action=save");
|
|
2397
|
+
}
|
|
2398
|
+
else if (action === "delete" || action === "reorder") {
|
|
2399
|
+
requireNonEmptyArray(args.ids, "ids");
|
|
2400
|
+
if (args.items !== undefined)
|
|
2401
|
+
cbamInputError("UNEXPECTED_ITEMS", "items", `items must be omitted when action=${action}`);
|
|
2402
|
+
}
|
|
2403
|
+
else if (action === "calculate") {
|
|
2404
|
+
if (args.items !== undefined || args.ids !== undefined) {
|
|
2405
|
+
cbamInputError("UNEXPECTED_PAYLOAD", "items", "items and ids must be omitted when action=calculate");
|
|
2406
|
+
}
|
|
2407
|
+
}
|
|
2408
|
+
}
|
|
2409
|
+
function validateCbamConfirmation(args, required) {
|
|
2410
|
+
if (!required || args.confirmed !== true)
|
|
2411
|
+
return;
|
|
2412
|
+
if (typeof args.pendingActionId !== "string" || args.pendingActionId.trim().length === 0) {
|
|
2413
|
+
cbamInputError("PENDING_ACTION_ID_REQUIRED", "pendingActionId", "pendingActionId returned by WAIT_CONFIRM is required when confirmed=true");
|
|
2414
|
+
}
|
|
2415
|
+
}
|
|
2416
|
+
function validateCbamSourceFlows(value) {
|
|
2417
|
+
if (!Array.isArray(value))
|
|
2418
|
+
return;
|
|
2419
|
+
for (let index = 0; index < value.length; index++) {
|
|
2420
|
+
const item = value[index];
|
|
2421
|
+
if (!item || typeof item !== "object" || Array.isArray(item))
|
|
2422
|
+
continue;
|
|
2423
|
+
const source = item;
|
|
2424
|
+
const sourceType = numericCode(source.sourceType);
|
|
2425
|
+
const processMethod = numericCode(source.processMethod);
|
|
2426
|
+
const path = `items[${index}]`;
|
|
2427
|
+
if (![1, 2, 3].includes(sourceType)) {
|
|
2428
|
+
cbamInputError("INVALID_SOURCE_FLOW_TYPE", `${path}.sourceType`, "sourceType must be 1, 2, or 3");
|
|
2429
|
+
}
|
|
2430
|
+
if (![1, 2, 3, 4, 5, 6, 7].includes(processMethod)) {
|
|
2431
|
+
cbamInputError("INVALID_PROCESS_METHOD", `${path}.processMethod`, "processMethod must be between 1 and 7");
|
|
2432
|
+
}
|
|
2433
|
+
if (sourceType === 1 && ![1, 2, 3].includes(processMethod)) {
|
|
2434
|
+
cbamInputError("INVALID_SOURCE_FLOW_COMBINATION", `${path}.processMethod`, "sourceType=1 supports processMethod 1, 2, or 3");
|
|
2435
|
+
}
|
|
2436
|
+
if (sourceType === 2 && ![4, 5].includes(processMethod)) {
|
|
2437
|
+
cbamInputError("INVALID_SOURCE_FLOW_COMBINATION", `${path}.processMethod`, "sourceType=2 supports processMethod 4 or 5");
|
|
2438
|
+
}
|
|
2439
|
+
if (sourceType === 3 && ![6, 7].includes(processMethod)) {
|
|
2440
|
+
cbamInputError("INVALID_SOURCE_FLOW_COMBINATION", `${path}.processMethod`, "sourceType=3 supports processMethod 6 or 7");
|
|
2441
|
+
}
|
|
2442
|
+
if (sourceType === 1 && processMethod === 1) {
|
|
2443
|
+
requireCbamFields(source, path, ["activityData", "emissionCoefficient", "oxRate"]);
|
|
2444
|
+
requireLowHeatForEnergyUnit(source, path);
|
|
2445
|
+
}
|
|
2446
|
+
else if (sourceType === 1 && processMethod === 2) {
|
|
2447
|
+
requireCbamFields(source, path, ["activityData", "emissionCoefficient", "conversionRate"]);
|
|
2448
|
+
requireLowHeatForEnergyUnit(source, path);
|
|
2449
|
+
}
|
|
2450
|
+
else if (sourceType === 1 && processMethod === 3) {
|
|
2451
|
+
requireCbamFields(source, path, ["activityData", "carbon", "biomassContent"]);
|
|
2452
|
+
}
|
|
2453
|
+
else if (sourceType === 2 && processMethod === 4) {
|
|
2454
|
+
requireCbamFields(source, path, ["activityData", "lowHeat", "emissionCoefficient", "conversionRate", "oxRate"]);
|
|
2455
|
+
}
|
|
2456
|
+
else if (sourceType === 2 && processMethod === 5) {
|
|
2457
|
+
requireCbamFields(source, path, ["activityData", "biomassContent", "carbon", "carbonFossil", "carbonBiological", "oxRate"]);
|
|
2458
|
+
if (Number(source.carbonFossil) === 0) {
|
|
2459
|
+
cbamInputError("INVALID_SOURCE_FLOW_VALUE", `${path}.carbonFossil`, "carbonFossil must be greater than zero for sourceType=2/processMethod=5");
|
|
2460
|
+
}
|
|
2461
|
+
if (Number(source.carbon) === 0) {
|
|
2462
|
+
cbamInputError("INVALID_SOURCE_FLOW_VALUE", `${path}.carbon`, "carbon must be greater than zero for sourceType=2/processMethod=5");
|
|
2463
|
+
}
|
|
2464
|
+
}
|
|
2465
|
+
else if (sourceType === 3 && [6, 7].includes(processMethod)) {
|
|
2466
|
+
requireCbamFields(source, path, ["lowHeat", "emissionCoefficient", "conversionRate", "biomassContent"]);
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2470
|
+
function numericCode(value) {
|
|
2471
|
+
if (typeof value === "number")
|
|
2472
|
+
return value;
|
|
2473
|
+
if (typeof value === "string" && /^\d+$/.test(value.trim()))
|
|
2474
|
+
return Number(value.trim());
|
|
2475
|
+
return Number.NaN;
|
|
2476
|
+
}
|
|
2477
|
+
function requireCbamFields(item, path, fields) {
|
|
2478
|
+
for (const field of fields) {
|
|
2479
|
+
if (item[field] === undefined || item[field] === null || item[field] === "") {
|
|
2480
|
+
cbamInputError("SOURCE_FLOW_FIELD_REQUIRED", `${path}.${field}`, `${field} is required for the selected sourceType/processMethod formula`);
|
|
2481
|
+
}
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
function requireLowHeatForEnergyUnit(item, path) {
|
|
2485
|
+
if (item.emissionCoefficientUnit === "tCO2/TJ") {
|
|
2486
|
+
requireCbamFields(item, path, ["lowHeat"]);
|
|
2487
|
+
}
|
|
2488
|
+
}
|
|
2489
|
+
function validateCbamDateRange(startValue, endValue) {
|
|
2490
|
+
const start = String(startValue || "");
|
|
2491
|
+
const end = String(endValue || "");
|
|
2492
|
+
if (!isExactCalendarDate(start))
|
|
2493
|
+
cbamInputError("INVALID_DATE", "report.startDate", "startDate must be a valid yyyy-MM-dd date");
|
|
2494
|
+
if (!isExactCalendarDate(end))
|
|
2495
|
+
cbamInputError("INVALID_DATE", "report.endDate", "endDate must be a valid yyyy-MM-dd date");
|
|
2496
|
+
if (start > end)
|
|
2497
|
+
cbamInputError("INVALID_PERIOD", "report.startDate", "startDate must not be after endDate");
|
|
2498
|
+
}
|
|
2499
|
+
function isExactCalendarDate(value) {
|
|
2500
|
+
const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
|
|
2501
|
+
if (!match)
|
|
2502
|
+
return false;
|
|
2503
|
+
const year = Number(match[1]);
|
|
2504
|
+
const month = Number(match[2]);
|
|
2505
|
+
const day = Number(match[3]);
|
|
2506
|
+
const date = new Date(Date.UTC(year, month - 1, day));
|
|
2507
|
+
return date.getUTCFullYear() === year
|
|
2508
|
+
&& date.getUTCMonth() === month - 1
|
|
2509
|
+
&& date.getUTCDate() === day;
|
|
2510
|
+
}
|
|
2511
|
+
function requireNonEmptyArray(value, path) {
|
|
2512
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
2513
|
+
cbamInputError("NON_EMPTY_ARRAY_REQUIRED", path, `${path} must be a non-empty array`);
|
|
2514
|
+
}
|
|
2515
|
+
}
|
|
2516
|
+
function requireUniqueIdArray(value, path) {
|
|
2517
|
+
if (!Array.isArray(value))
|
|
2518
|
+
return;
|
|
2519
|
+
requireUniqueValues(value.map(String), path);
|
|
2520
|
+
}
|
|
2521
|
+
function requireUniqueItemIds(value) {
|
|
2522
|
+
if (!Array.isArray(value))
|
|
2523
|
+
return;
|
|
2524
|
+
const ids = value
|
|
2525
|
+
.filter((item) => item && typeof item === "object" && !Array.isArray(item))
|
|
2526
|
+
.map((item) => item.id)
|
|
2527
|
+
.filter((id) => id !== undefined && id !== null)
|
|
2528
|
+
.map(String);
|
|
2529
|
+
requireUniqueValues(ids, "items.id");
|
|
2530
|
+
}
|
|
2531
|
+
function requireUniqueValues(values, path) {
|
|
2532
|
+
const seen = new Set();
|
|
2533
|
+
for (const value of values) {
|
|
2534
|
+
if (seen.has(value))
|
|
2535
|
+
cbamInputError("DUPLICATE_VALUE", path, `${path} must not contain duplicate values`);
|
|
2536
|
+
seen.add(value);
|
|
2537
|
+
}
|
|
2538
|
+
}
|
|
2539
|
+
function cbamInputError(code, path, message) {
|
|
2540
|
+
throw new ToolInputValidationError(code, path, message);
|
|
2541
|
+
}
|
|
1680
2542
|
function validateEnterpriseEmissionSaveArgs(orgList) {
|
|
1681
2543
|
const seen = new Map();
|
|
1682
2544
|
for (let orgIndex = 0; orgIndex < orgList.length; orgIndex++) {
|
|
@@ -1829,11 +2691,24 @@ function isIdField(key) {
|
|
|
1829
2691
|
|| key === "factorId"
|
|
1830
2692
|
|| key === "orgId"
|
|
1831
2693
|
|| key === "computationId"
|
|
1832
|
-
|| key === "sourceId"
|
|
2694
|
+
|| key === "sourceId"
|
|
2695
|
+
|| key === "factoryId"
|
|
2696
|
+
|| key === "generationId"
|
|
2697
|
+
|| key === "itemId"
|
|
2698
|
+
|| key === "productCategoryId"
|
|
2699
|
+
|| key === "productProcessId"
|
|
2700
|
+
|| key === "relationId"
|
|
2701
|
+
|| key === "defaultCnId"
|
|
2702
|
+
|| key === "processId"
|
|
2703
|
+
|| key === "saleProductId"
|
|
2704
|
+
|| key === "emissionSourceSaleProductId"
|
|
2705
|
+
|| key === "emissionSourceDefaultCnId"
|
|
2706
|
+
|| key === "productBenchmarkId";
|
|
1833
2707
|
}
|
|
1834
2708
|
function isIdListField(key) {
|
|
1835
2709
|
return key === "computationIdList"
|
|
1836
|
-
|| key === "sourceIdList"
|
|
2710
|
+
|| key === "sourceIdList"
|
|
2711
|
+
|| key === "ids";
|
|
1837
2712
|
}
|
|
1838
2713
|
function normalizeNumericId(value) {
|
|
1839
2714
|
const numericValue = Number(value);
|