@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/AGENTS.md CHANGED
@@ -5,7 +5,7 @@
5
5
  This is an MCP server for Carbonstop server-side Agent usage. It supports stdio for local MCP clients and Streamable HTTP for deployed Agent services. It wraps Java internal Agent APIs through gateway service prefixes:
6
6
 
7
7
  - `/footprint3/agent/internal/skills/**`
8
- - `/cbam2/agent/internal/skills/cbam2/**`
8
+ - `/cbam2/agent/internal/skills/cbam/**`
9
9
 
10
10
  ## Authentication
11
11
 
@@ -41,6 +41,6 @@ src/version.ts version info
41
41
 
42
42
  - Product carbon skills: `modeling_preview`, `modeling_execute`, `modeling_re_modeling`, `modeling_update`, `modeling_detail`
43
43
  - Report skills: `report_generate`, `report_regenerate`, `report_detail`
44
- - CBAM2 skills: 16 task-oriented `cbam2_*` tools route to 31 Java atomic endpoints; keep action/view routing controls out of Java request bodies
44
+ - CBAM skills: 15 Agent-visible task-oriented `cbam_*` tools route to 31 Java atomic endpoints; report-generation polling remains internal to MCP, and action/view routing controls stay out of Java request bodies
45
45
 
46
46
  Write or high-risk tools require `idempotencyKey`.
package/README.md CHANGED
@@ -60,7 +60,7 @@ export CARBONSTOP_AGENT_BASE_URL="https://your-gateway-host"
60
60
 
61
61
  `CARBONSTOP_BASE_URL` is also accepted as a compatibility fallback.
62
62
 
63
- Backend requests use `CARBONSTOP_TIMEOUT` seconds, defaulting to 60. `enterprise_report_generate`, `enterprise_report_regenerate`, `enterprise_report_file_record_retry`, and `cbam2_report_generate` always use at least 120 seconds; a larger `CARBONSTOP_TIMEOUT` value also applies to them. They are never automatically retried by the MCP server: timeout, network, HTTP 429, or HTTP 5xx failures are returned immediately so a report API is not called twice. Configure the Agent MCP client, reverse proxy, and gateway timeouts above the report timeout.
63
+ Backend requests use `CARBONSTOP_TIMEOUT` seconds, defaulting to 60. `enterprise_report_generate`, `enterprise_report_regenerate`, and `enterprise_report_file_record_retry` always use at least 120 seconds, and a larger `CARBONSTOP_TIMEOUT` value also applies to them. CBAM report generation instead has one 120-second end-to-end MCP budget: the asynchronous task-start request uses an exact 20-second timeout, followed by at most 100 seconds of internal status polling, with every status request capped by the remaining total budget. Report write requests are never automatically retried, so timeout, network, HTTP 429, or HTTP 5xx failures cannot start the same report twice. Configure the Agent MCP client, reverse proxy, and gateway timeouts above 120 seconds.
64
64
 
65
65
  ### Streamable HTTP
66
66
 
@@ -162,7 +162,7 @@ MCP-local cross-field validation failures are never sent to the backend. They re
162
162
 
163
163
  Ordinary missing-field and field-type errors are rejected by the MCP SDK as JSON-RPC `-32602` invalid-argument errors. Enterprise emission factor-mode rules are also published in `tools/list.inputSchema` using Draft-07 `allOf`, `not`, `if`, and `then`, so schema-aware clients can reject an invalid call before dispatch.
164
164
 
165
- See [`docs/schema-audit.md`](docs/schema-audit.md) for the 71-tool contract inventory, compatibility matrix, and remaining review items.
165
+ See [`docs/schema-audit.md`](docs/schema-audit.md) for the 70-tool contract inventory, compatibility matrix, and remaining review items.
166
166
 
167
167
  ## MCP Client Config
168
168
 
@@ -215,27 +215,26 @@ For local debugging against a non-default gateway, add:
215
215
 
216
216
  ## Available Tools
217
217
 
218
- Only Agent-facing project collaboration, memory, product carbon, enterprise carbon, CBAM2, factor search, and unit dictionary tools are exposed in this release.
218
+ Only Agent-facing project collaboration, memory, product carbon, enterprise carbon, CBAM, factor search, and unit dictionary tools are exposed in this release.
219
219
 
220
220
  | Tool | Description |
221
221
  | --- | --- |
222
- | `session_carbon_objects` | Recover product-carbon accounts, enterprise-carbon computations, and CBAM2 reports bound to the current session. `module` is optional and supports `footprint3`, `enterprise`, and `cbam2`. One session may contain multiple `cbam2Reports[]`; always select and pass the exact `reportId`. |
223
- | `cbam2_reference_search` | Query accessible organizations/factories and CBAM2 country, currency, enum, category, default-value, and report-scoped tax-candidate data. |
224
- | `cbam2_report_search` | Search visible CBAM2 reports by name, organization, factory, year, and pagination. |
225
- | `cbam2_report_read` | Unified report read with `view=snapshot/section/item/result/readiness/carbon_tax_status`; routes to six read-only Java endpoints. |
226
- | `cbam2_factory_read` | Read one complete CBAM2 factory form before a full update. |
227
- | `cbam2_factory_save` | Create or fully update a shared factory with `action=create/update`. Uses WAIT_CONFIRM and is never automatically retried. |
228
- | `cbam2_report_save` | Create or fully update report general information with `action=create/update`. Every create adds another report to the same session instead of replacing an earlier report. |
229
- | `cbam2_process_manage` | Save, delete, or reorder self-produced process definitions with `action=save/delete/reorder`. |
230
- | `cbam2_precursor_manage` | Save or delete manually entered purchased precursors. |
231
- | `cbam2_source_flow_manage` | Save or delete process source-flow rows; backend recalculates direct emissions. |
232
- | `cbam2_heat_power_update` | Update heat-power input data; backend owns calculated output fields. |
233
- | `cbam2_product_data_update` | Update process or precursor activity/emission data using `dataType=process/precursor`. |
234
- | `cbam2_sale_product_manage` | Save or delete sale products while protecting backend-calculated emissions and tax fields. |
235
- | `cbam2_carbon_tax_manage` | Save/delete tax rows or start asynchronous calculation with `action=save/delete/calculate`. |
236
- | `cbam2_data_quality_update` | Update the complete report data-quality form. |
237
- | `cbam2_report_generate` | Start backend CBAM2 file generation through WAIT_CONFIRM; the resulting file is recorded in Carbon Cloud download management. |
238
- | `cbam2_report_generation_status` | Poll one report-generation task by exact `reportId` and `generationId`. |
222
+ | `session_carbon_objects` | Recover product-carbon accounts, enterprise-carbon computations, and CBAM reports bound to the current session. `module` is optional and supports `footprint3`, `enterprise`, and `cbam`. One session may contain multiple `cbamReports[]`; always select and pass the exact `reportId`. |
223
+ | `cbam_reference_search` | Query accessible organizations/factories and CBAM country, currency, enum, category, default-value, and report-scoped tax-candidate data. |
224
+ | `cbam_report_search` | Search visible CBAM reports by name, organization, factory, year, and pagination. |
225
+ | `cbam_report_read` | Unified report read with `view=snapshot/section/item/result/readiness/carbon_tax_status`; routes to six read-only Java endpoints. |
226
+ | `cbam_factory_read` | Read one complete CBAM factory form before a full update. |
227
+ | `cbam_factory_save` | Create or fully update a shared factory with `action=create/update`. Requires existing Agent approval and wrapper-injected `confirmed=true`; never automatically retried. |
228
+ | `cbam_report_save` | Create or fully update report general information with `action=create/update`. Every create adds another report to the same session instead of replacing an earlier report. |
229
+ | `cbam_process_manage` | Save, delete, or reorder self-produced process definitions with `action=save/delete/reorder`. |
230
+ | `cbam_precursor_manage` | Save or delete manually entered purchased precursors. |
231
+ | `cbam_source_flow_manage` | Save or delete process source-flow rows; backend recalculates direct emissions. |
232
+ | `cbam_heat_power_update` | Update heat-power input data; backend owns calculated output fields. |
233
+ | `cbam_product_data_update` | Update process or precursor activity/emission data using `dataType=process/precursor`. |
234
+ | `cbam_sale_product_manage` | Save or delete sale products while protecting backend-calculated emissions and tax fields. |
235
+ | `cbam_carbon_tax_manage` | Save/delete tax rows or start asynchronous calculation with `action=save/delete/calculate`. |
236
+ | `cbam_data_quality_update` | Update the complete report data-quality form. |
237
+ | `cbam_report_generate` | After existing Agent approval, start backend CBAM file generation with wrapper-injected `confirmed=true`, wait internally for completion, and return the Carbon Cloud download record. The status route is not exposed to the Agent. |
239
238
  | `user_memory_recall` | Recall the current user's cross-session preferences, constraints, domain habits, and format habits. Requires `sessionId`, current `messageId`, and `query`; supports optional `memoryTypes` and `limit`. Current instructions and business data always take precedence. |
240
239
  | `user_memory_get` | Read one memory and its latest version before an exact update or forget action. Requires `sessionId`, `messageId`, and `memoryId`. |
241
240
  | `user_memory_upsert` | Create or version-update one stable user memory after an explicit remember request or confirmation. Requires `scope`, `type`, `memoryKey`, and `content`; an exact update requires `memoryId`, while `expectedVersion` is recommended but may be omitted or set to `0`. |
@@ -384,23 +383,23 @@ Use the product carbon modeling tools as follows:
384
383
  - `modeling_execute_structured`: create a new model only after the Agent has extracted structured product data, emission sources, transport legs, and factor selections. Attach routine material or packaging transport to the parent emission source's `transport[]`; do not create a separate transport source unless the user explicitly asks for a standalone logistics activity.
385
384
  - `unit_list`: query available units before `modeling_execute_structured`, then use returned `dictLabel` values as `unitName`.
386
385
 
387
- ### CBAM2 Tool Selection
386
+ ### CBAM Tool Selection
388
387
 
389
- The Java service retains 31 atomic endpoints, while MCP exposes 16 task-oriented tools. Dynamic `action`, `view`, and `dataType` values select exactly one Java endpoint per call; MCP removes those routing-only fields before dispatch.
388
+ The Java service retains 31 atomic endpoints, while MCP exposes 15 task-oriented tools. Dynamic `action`, `view`, and `dataType` values select exactly one Java endpoint per call; MCP removes those routing-only fields before dispatch. The report-generation status endpoint remains internal to the composite `cbam_report_generate` implementation.
390
389
 
391
- 1. Start with `session_carbon_objects(module="cbam2")` or `cbam2_report_search`. One session may contain multiple reports. If more than one candidate fits, ask the user which report to use and pass its exact `reportId` on every later call.
392
- 2. Use `cbam2_reference_search` for organizations, factories, countries, currencies, CBAM enum codes, product categories, defaults, and carbon-tax candidates. Never invent an id/code. `CARBON_TAX_CANDIDATE` requires the selected `reportId`.
393
- 3. Create a missing factory through `cbam2_factory_save(action="create")`; update only after `cbam2_factory_read`. Factory create/update changes shared data and uses the backend `WAIT_CONFIRM` two-step contract.
394
- 4. Create report general information with `cbam2_report_save(action="create")`. Each call creates and session-binds a new CBAM2 report. It never overwrites the prior report in that session. General information is sufficient to request report generation; the remaining sections progressively improve completeness.
395
- 5. Before changing an existing report or section, use `cbam2_report_read`. Use `view=section` for complete form data and `view=item` for one child record. Do not reuse an item id with another report id.
396
- 6. Maintain process definitions, precursors, and source flows with their `*_manage` tools. `save` accepts create/update batches; `delete` uses exact ids and `WAIT_CONFIRM`; process `reorder` must contain every current process id once.
397
- 7. Update heat-power and process/precursor product activity through `cbam2_heat_power_update` and `cbam2_product_data_update`. The backend validates balances, preserves definitions, and calculates derived values.
398
- 8. Maintain sale products and tax inputs with `cbam2_sale_product_manage` and `cbam2_carbon_tax_manage`. Calculated emissions, versions, fill status, snapshots, and pay-tax fields are backend-owned and absent from the MCP schemas.
399
- 9. `cbam2_carbon_tax_manage(action="calculate")` is asynchronous and requires `WAIT_CONFIRM`. Poll `cbam2_report_read(view="carbon_tax_status")` after the confirmed start call.
400
- 10. Use `cbam2_report_read(view="readiness")` to explain blockers/warnings. It is advisory: basic information alone can still start generation under the migrated CBAM2 rule.
401
- 11. `cbam2_report_generate` uses `WAIT_CONFIRM`, starts backend file generation, and never retries automatically. Poll `cbam2_report_generation_status` with the returned `generationId`. The backend-generated file is the final artifact and is also registered in Carbon Cloud download management.
390
+ 1. Start with `session_carbon_objects(module="cbam")` or `cbam_report_search`. One session may contain multiple reports. If more than one candidate fits, ask the user which report to use and pass its exact `reportId` on every later call.
391
+ 2. Use `cbam_reference_search` for organizations, factories, countries, currencies, CBAM enum codes, product categories, defaults, and carbon-tax candidates. Never invent an id/code. `CARBON_TAX_CANDIDATE` requires the selected `reportId`.
392
+ 3. Create a missing factory through `cbam_factory_save(action="create")`; update only after `cbam_factory_read`. Factory create/update changes shared data, so the Agent wrapper must complete the existing approval interrupt before making the single MCP call with `confirmed=true`.
393
+ 4. Create report general information with `cbam_report_save(action="create")`. Each call creates and session-binds a new CBAM report. It never overwrites the prior report in that session. General information is sufficient to request report generation; the remaining sections progressively improve completeness.
394
+ 5. Before changing an existing report or section, use `cbam_report_read`. Use `view=section` for complete form data and `view=item` for one child record. Do not reuse an item id with another report id.
395
+ 6. Maintain process definitions, precursors, and source flows with their `*_manage` tools. `save` accepts create/update batches; `delete` uses exact ids and requires prior Agent approval plus `confirmed=true`; process `reorder` must contain every current process id once.
396
+ 7. Update heat-power and process/precursor product activity through `cbam_heat_power_update` and `cbam_product_data_update`. The backend validates balances, preserves definitions, and calculates derived values.
397
+ 8. Maintain sale products and tax inputs with `cbam_sale_product_manage` and `cbam_carbon_tax_manage`. Calculated emissions, versions, fill status, snapshots, and pay-tax fields are backend-owned and absent from the MCP schemas.
398
+ 9. `cbam_carbon_tax_manage(action="calculate")` is asynchronous and requires prior Agent approval with wrapper-injected `confirmed=true`. Poll `cbam_report_read(view="carbon_tax_status")` after the start call.
399
+ 10. Use `cbam_report_read(view="readiness")` to explain blockers/warnings. It is advisory: basic information alone can still start generation under the migrated CBAM rule.
400
+ 11. Call `cbam_report_generate` once after the existing Agent approval. MCP starts backend generation once, polls the internal status route, and normally returns `COMPLETED` with the final download file. If the 100-second wait expires, the tool returns `RUNNING` with `timedOut=true`; call the same tool again with the same `idempotencyKey` to continue waiting for the same `generationId`. The backend-generated file is also registered in Carbon Cloud download management.
402
401
 
403
- Every CBAM2 write requires `idempotencyKey`. Factory changes, all deletes, carbon-tax calculation, and report generation require the first `WAIT_CONFIRM` response followed by the identical business payload and idempotency key with `confirmed=true` plus the returned `pendingActionId`.
402
+ Every CBAM write requires `idempotencyKey`. The model-facing wrapper should hide technical approval/idempotency fields. Factory changes, all deletes, carbon-tax calculation, and report generation must reuse the existing Agent approval interrupt; after approval the wrapper injects `confirmed=true` and the stable `idempotencyKey` into one MCP call. Rejection makes no MCP call.
404
403
 
405
404
  ### Enterprise Carbon Tool Selection
406
405
 
@@ -1237,7 +1236,7 @@ Write or high-risk tools require `idempotencyKey`, especially:
1237
1236
  - `modeling_re_modeling`
1238
1237
  - `report_generate`
1239
1238
  - `report_regenerate`
1240
- - every `cbam2_*` write tool
1239
+ - every `cbam_*` write tool
1241
1240
 
1242
1241
  ## API Routes
1243
1242
 
@@ -1247,10 +1246,10 @@ Product carbon skill APIs are called through the `footprint3` gateway prefix:
1247
1246
  /footprint3/agent/internal/skills/**
1248
1247
  ```
1249
1248
 
1250
- CBAM2 Agent skill APIs are called through the dedicated `cbam2` gateway prefix:
1249
+ CBAM Agent skill APIs use `cbam_*` tool names. The backend gateway retains its historical `/cbam2` service prefix, while the skill alias is `/cbam/**`:
1251
1250
 
1252
1251
  ```text
1253
- /cbam2/agent/internal/skills/cbam2/**
1252
+ /cbam2/agent/internal/skills/cbam/**
1254
1253
  ```
1255
1254
 
1256
1255
  Workspace sandbox APIs are called through the `ai` gateway prefix:
package/dist/apipath.d.ts CHANGED
@@ -57,37 +57,37 @@ export declare const EnterpriseReportOrgTree: () => string;
57
57
  export declare const EnterpriseEmissionBatchSave: () => string;
58
58
  export declare const EnterpriseEmissionBatchUpdate: () => string;
59
59
  export declare const EnterpriseEmissionBatchDelete: () => string;
60
- export declare const Cbam2ReferenceSearch: () => string;
61
- export declare const Cbam2ReportSearch: () => string;
62
- export declare const Cbam2ReportSnapshot: () => string;
63
- export declare const Cbam2SectionSnapshot: () => string;
64
- export declare const Cbam2ItemDetail: () => string;
65
- export declare const Cbam2ResultSummary: () => string;
66
- export declare const Cbam2ReportReadiness: () => string;
67
- export declare const Cbam2CarbonTaxStatus: () => string;
68
- export declare const Cbam2ReportGenerationStatus: () => string;
69
- export declare const Cbam2FactoryDetail: () => string;
70
- export declare const Cbam2FactoryCreate: () => string;
71
- export declare const Cbam2FactoryUpdate: () => string;
72
- export declare const Cbam2ReportCreate: () => string;
73
- export declare const Cbam2ReportUpdate: () => string;
74
- export declare const Cbam2ProcessBatchSave: () => string;
75
- export declare const Cbam2ProcessBatchDelete: () => string;
76
- export declare const Cbam2ProcessReorder: () => string;
77
- export declare const Cbam2PrecursorBatchSave: () => string;
78
- export declare const Cbam2PrecursorBatchDelete: () => string;
79
- export declare const Cbam2SourceFlowBatchSave: () => string;
80
- export declare const Cbam2SourceFlowBatchDelete: () => string;
81
- export declare const Cbam2HeatPowerUpdate: () => string;
82
- export declare const Cbam2ProcessProductBatchUpdate: () => string;
83
- export declare const Cbam2PrecursorProductBatchUpdate: () => string;
84
- export declare const Cbam2SaleProductBatchSave: () => string;
85
- export declare const Cbam2SaleProductBatchDelete: () => string;
86
- export declare const Cbam2CarbonTaxBatchSave: () => string;
87
- export declare const Cbam2CarbonTaxBatchDelete: () => string;
88
- export declare const Cbam2CarbonTaxCalculate: () => string;
89
- export declare const Cbam2DataQualityUpdate: () => string;
90
- export declare const Cbam2ReportGenerate: () => string;
60
+ export declare const CbamReferenceSearch: () => string;
61
+ export declare const CbamReportSearch: () => string;
62
+ export declare const CbamReportSnapshot: () => string;
63
+ export declare const CbamSectionSnapshot: () => string;
64
+ export declare const CbamItemDetail: () => string;
65
+ export declare const CbamResultSummary: () => string;
66
+ export declare const CbamReportReadiness: () => string;
67
+ export declare const CbamCarbonTaxStatus: () => string;
68
+ export declare const CbamReportGenerationStatus: () => string;
69
+ export declare const CbamFactoryDetail: () => string;
70
+ export declare const CbamFactoryCreate: () => string;
71
+ export declare const CbamFactoryUpdate: () => string;
72
+ export declare const CbamReportCreate: () => string;
73
+ export declare const CbamReportUpdate: () => string;
74
+ export declare const CbamProcessBatchSave: () => string;
75
+ export declare const CbamProcessBatchDelete: () => string;
76
+ export declare const CbamProcessReorder: () => string;
77
+ export declare const CbamPrecursorBatchSave: () => string;
78
+ export declare const CbamPrecursorBatchDelete: () => string;
79
+ export declare const CbamSourceFlowBatchSave: () => string;
80
+ export declare const CbamSourceFlowBatchDelete: () => string;
81
+ export declare const CbamHeatPowerUpdate: () => string;
82
+ export declare const CbamProcessProductBatchUpdate: () => string;
83
+ export declare const CbamPrecursorProductBatchUpdate: () => string;
84
+ export declare const CbamSaleProductBatchSave: () => string;
85
+ export declare const CbamSaleProductBatchDelete: () => string;
86
+ export declare const CbamCarbonTaxBatchSave: () => string;
87
+ export declare const CbamCarbonTaxBatchDelete: () => string;
88
+ export declare const CbamCarbonTaxCalculate: () => string;
89
+ export declare const CbamDataQualityUpdate: () => string;
90
+ export declare const CbamReportGenerate: () => string;
91
91
  export declare const CompanyOrgSubjectQuery: () => string;
92
92
  export declare const CompanyOrgSubjectBatchAdd: () => string;
93
93
  export declare const CompanyOrgSubjectBatchUpdate: () => string;
package/dist/apipath.js CHANGED
@@ -2,7 +2,8 @@ const aiPrefix = "/ai";
2
2
  const footprint3Prefix = "/footprint3";
3
3
  const managementPrefix = "/management";
4
4
  const enterpriseComputationPrefix = "/enterprise";
5
- const cbam2Prefix = "/cbam2";
5
+ // The gateway service keeps its historical /cbam2 route; Agent-facing tools use CBAM naming.
6
+ const cbamGatewayPrefix = "/cbam2";
6
7
  export const SessionContext = () => `${aiPrefix}/agent/internal/platform/sessionContext`;
7
8
  export const SessionBusinessRefs = () => `${aiPrefix}/agent/internal/platform/sessionBusinessRefs`;
8
9
  export const UserMemoryRecall = () => `${aiPrefix}/agent/internal/memory/recall`;
@@ -62,38 +63,38 @@ export const EnterpriseReportOrgTree = () => `${enterpriseComputationPrefix}/age
62
63
  export const EnterpriseEmissionBatchSave = () => `${enterpriseComputationPrefix}/agent/emission/batchSave`;
63
64
  export const EnterpriseEmissionBatchUpdate = () => `${enterpriseComputationPrefix}/agent/emission/batchUpdate`;
64
65
  export const EnterpriseEmissionBatchDelete = () => `${enterpriseComputationPrefix}/agent/emission/batchDelete`;
65
- const cbam2Skill = (path) => `${cbam2Prefix}/agent/internal/skills/cbam2/${path}`;
66
- export const Cbam2ReferenceSearch = () => cbam2Skill("reference/search");
67
- export const Cbam2ReportSearch = () => cbam2Skill("report/search");
68
- export const Cbam2ReportSnapshot = () => cbam2Skill("report/snapshot");
69
- export const Cbam2SectionSnapshot = () => cbam2Skill("section/snapshot");
70
- export const Cbam2ItemDetail = () => cbam2Skill("item/detail");
71
- export const Cbam2ResultSummary = () => cbam2Skill("result/summary");
72
- export const Cbam2ReportReadiness = () => cbam2Skill("report/readiness");
73
- export const Cbam2CarbonTaxStatus = () => cbam2Skill("carbon-tax/status");
74
- export const Cbam2ReportGenerationStatus = () => cbam2Skill("report/generation/status");
75
- export const Cbam2FactoryDetail = () => cbam2Skill("factory/detail");
76
- export const Cbam2FactoryCreate = () => cbam2Skill("factory/create");
77
- export const Cbam2FactoryUpdate = () => cbam2Skill("factory/update");
78
- export const Cbam2ReportCreate = () => cbam2Skill("report/create");
79
- export const Cbam2ReportUpdate = () => cbam2Skill("report/update");
80
- export const Cbam2ProcessBatchSave = () => cbam2Skill("process/batchSave");
81
- export const Cbam2ProcessBatchDelete = () => cbam2Skill("process/batchDelete");
82
- export const Cbam2ProcessReorder = () => cbam2Skill("process/reorder");
83
- export const Cbam2PrecursorBatchSave = () => cbam2Skill("precursor/batchSave");
84
- export const Cbam2PrecursorBatchDelete = () => cbam2Skill("precursor/batchDelete");
85
- export const Cbam2SourceFlowBatchSave = () => cbam2Skill("source-flow/batchSave");
86
- export const Cbam2SourceFlowBatchDelete = () => cbam2Skill("source-flow/batchDelete");
87
- export const Cbam2HeatPowerUpdate = () => cbam2Skill("heat-power/update");
88
- export const Cbam2ProcessProductBatchUpdate = () => cbam2Skill("product-data/process/batchUpdate");
89
- export const Cbam2PrecursorProductBatchUpdate = () => cbam2Skill("product-data/precursor/batchUpdate");
90
- export const Cbam2SaleProductBatchSave = () => cbam2Skill("sale-product/batchSave");
91
- export const Cbam2SaleProductBatchDelete = () => cbam2Skill("sale-product/batchDelete");
92
- export const Cbam2CarbonTaxBatchSave = () => cbam2Skill("carbon-tax/batchSave");
93
- export const Cbam2CarbonTaxBatchDelete = () => cbam2Skill("carbon-tax/batchDelete");
94
- export const Cbam2CarbonTaxCalculate = () => cbam2Skill("carbon-tax/calculate");
95
- export const Cbam2DataQualityUpdate = () => cbam2Skill("data-quality/update");
96
- export const Cbam2ReportGenerate = () => cbam2Skill("report/generate");
66
+ const cbamSkill = (path) => `${cbamGatewayPrefix}/agent/internal/skills/cbam/${path}`;
67
+ export const CbamReferenceSearch = () => cbamSkill("reference/search");
68
+ export const CbamReportSearch = () => cbamSkill("report/search");
69
+ export const CbamReportSnapshot = () => cbamSkill("report/snapshot");
70
+ export const CbamSectionSnapshot = () => cbamSkill("section/snapshot");
71
+ export const CbamItemDetail = () => cbamSkill("item/detail");
72
+ export const CbamResultSummary = () => cbamSkill("result/summary");
73
+ export const CbamReportReadiness = () => cbamSkill("report/readiness");
74
+ export const CbamCarbonTaxStatus = () => cbamSkill("carbon-tax/status");
75
+ export const CbamReportGenerationStatus = () => cbamSkill("report/generation/status");
76
+ export const CbamFactoryDetail = () => cbamSkill("factory/detail");
77
+ export const CbamFactoryCreate = () => cbamSkill("factory/create");
78
+ export const CbamFactoryUpdate = () => cbamSkill("factory/update");
79
+ export const CbamReportCreate = () => cbamSkill("report/create");
80
+ export const CbamReportUpdate = () => cbamSkill("report/update");
81
+ export const CbamProcessBatchSave = () => cbamSkill("process/batchSave");
82
+ export const CbamProcessBatchDelete = () => cbamSkill("process/batchDelete");
83
+ export const CbamProcessReorder = () => cbamSkill("process/reorder");
84
+ export const CbamPrecursorBatchSave = () => cbamSkill("precursor/batchSave");
85
+ export const CbamPrecursorBatchDelete = () => cbamSkill("precursor/batchDelete");
86
+ export const CbamSourceFlowBatchSave = () => cbamSkill("source-flow/batchSave");
87
+ export const CbamSourceFlowBatchDelete = () => cbamSkill("source-flow/batchDelete");
88
+ export const CbamHeatPowerUpdate = () => cbamSkill("heat-power/update");
89
+ export const CbamProcessProductBatchUpdate = () => cbamSkill("product-data/process/batchUpdate");
90
+ export const CbamPrecursorProductBatchUpdate = () => cbamSkill("product-data/precursor/batchUpdate");
91
+ export const CbamSaleProductBatchSave = () => cbamSkill("sale-product/batchSave");
92
+ export const CbamSaleProductBatchDelete = () => cbamSkill("sale-product/batchDelete");
93
+ export const CbamCarbonTaxBatchSave = () => cbamSkill("carbon-tax/batchSave");
94
+ export const CbamCarbonTaxBatchDelete = () => cbamSkill("carbon-tax/batchDelete");
95
+ export const CbamCarbonTaxCalculate = () => cbamSkill("carbon-tax/calculate");
96
+ export const CbamDataQualityUpdate = () => cbamSkill("data-quality/update");
97
+ export const CbamReportGenerate = () => cbamSkill("report/generate");
97
98
  export const CompanyOrgSubjectQuery = () => `${managementPrefix}/companyOrg/agent/orgNames`;
98
99
  export const CompanyOrgSubjectBatchAdd = () => `${managementPrefix}/companyOrg/agent/batchAdd`;
99
100
  export const CompanyOrgSubjectBatchUpdate = () => `${managementPrefix}/companyOrg/agent/batchUpdate`;
@@ -1 +1 @@
1
- {"version":3,"file":"apipath.js","sourceRoot":"","sources":["../src/apipath.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG,KAAK,CAAC;AACvB,MAAM,gBAAgB,GAAG,aAAa,CAAC;AACvC,MAAM,gBAAgB,GAAG,aAA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,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,0BAA0B,CAAC,CAAC;AACtF,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC;AAC9E,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAC;AAClF,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC;AAC9E,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;AAC5E,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;AAErE,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,EAAE,CAAC,GAAG,gBAAgB,4BAA4B,CAAC;AAC5F,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,EAAE,CAAC,GAAG,gBAAgB,4BAA4B,CAAC;AAC/F,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,EAAE,CAAC,GAAG,gBAAgB,+BAA+B,CAAC"}
@@ -0,0 +1,20 @@
1
+ export interface BackendResponse {
2
+ status: number;
3
+ body: string;
4
+ }
5
+ export interface CbamReportWaitOptions {
6
+ timeoutMs?: number;
7
+ pollIntervalMs?: number;
8
+ now?: () => number;
9
+ sleep?: (milliseconds: number) => Promise<void>;
10
+ }
11
+ export declare const cbamReportTotalTimeoutMs = 120000;
12
+ export declare const cbamReportPollTimeoutMs = 100000;
13
+ export declare const cbamReportStartTimeoutSeconds = 20;
14
+ export declare const cbamReportStatusTimeoutMs = 10000;
15
+ /**
16
+ * Keeps CBAM report generation asynchronous in Java while presenting one
17
+ * synchronous-looking MCP call. The status endpoint remains an internal
18
+ * implementation detail and the generation write is never repeated here.
19
+ */
20
+ export declare function waitForCbamReportGeneration(started: BackendResponse, pollStatus: (generationId: string | number, remainingMs: number) => Promise<BackendResponse>, options?: CbamReportWaitOptions): Promise<BackendResponse>;
@@ -0,0 +1,174 @@
1
+ import { responseBusinessError } from "./logger.js";
2
+ const defaultTimeoutMs = 100_000;
3
+ const defaultPollIntervalMs = 2_000;
4
+ export const cbamReportTotalTimeoutMs = 120_000;
5
+ export const cbamReportPollTimeoutMs = 100_000;
6
+ export const cbamReportStartTimeoutSeconds = 20;
7
+ export const cbamReportStatusTimeoutMs = 10_000;
8
+ /**
9
+ * Keeps CBAM report generation asynchronous in Java while presenting one
10
+ * synchronous-looking MCP call. The status endpoint remains an internal
11
+ * implementation detail and the generation write is never repeated here.
12
+ */
13
+ export async function waitForCbamReportGeneration(started, pollStatus, options = {}) {
14
+ const startedPayload = parsePayload(started.body);
15
+ const generationId = idValue(startedPayload?.generationId);
16
+ const reportId = idValue(startedPayload?.reportId);
17
+ if (generationId === undefined || reportId === undefined) {
18
+ return failureResponse(started.body, 502, "REPORT_GENERATION_RESPONSE_INVALID", "CBAM report generation did not return reportId and generationId", reportId, generationId, false);
19
+ }
20
+ const now = options.now || Date.now;
21
+ const sleep = options.sleep || ((milliseconds) => new Promise((resolve) => {
22
+ setTimeout(resolve, milliseconds);
23
+ }));
24
+ const timeoutMs = nonNegativeNumber(options.timeoutMs, defaultTimeoutMs);
25
+ const pollIntervalMs = positiveNumber(options.pollIntervalMs, defaultPollIntervalMs);
26
+ const deadline = now() + timeoutMs;
27
+ let lastSuccessfulStatus;
28
+ let lastPollingIssue;
29
+ while (now() < deadline) {
30
+ try {
31
+ const remainingBeforePoll = deadline - now();
32
+ if (remainingBeforePoll <= 0)
33
+ break;
34
+ const result = await pollStatus(generationId, remainingBeforePoll);
35
+ if (result.status >= 200 && result.status < 300) {
36
+ // Carbon APIs may report a business failure with HTTP 200. Preserve
37
+ // that response so the normal MCP error mapper can expose its real
38
+ // code and message instead of replacing it with "unknown status".
39
+ if (responseBusinessError(result.body))
40
+ return result;
41
+ const responseRoot = parseRecord(result.body);
42
+ const envelope = asRecord(responseRoot.data);
43
+ if (envelope?.success === false || stringValue(envelope?.status)?.toUpperCase() === "FAILED") {
44
+ return result;
45
+ }
46
+ const payload = parsePayloadRecord(responseRoot);
47
+ const status = stringValue(payload?.status)?.toUpperCase();
48
+ if (status === "COMPLETED") {
49
+ return completedResponse(result, reportId, generationId);
50
+ }
51
+ if (status === "FAILED") {
52
+ const reason = stringValue(payload?.failureReason)
53
+ || stringValue(asRecord(payload?.file)?.info)
54
+ || "CBAM report generation failed";
55
+ return failureResponse(result.body, 200, "REPORT_GENERATION_FAILED", reason, reportId, generationId, false, payload);
56
+ }
57
+ if (status !== "RUNNING") {
58
+ return failureResponse(result.body, 502, "REPORT_GENERATION_STATUS_INVALID", "CBAM report generation returned an unknown status", reportId, generationId, true, payload);
59
+ }
60
+ lastSuccessfulStatus = result;
61
+ lastPollingIssue = undefined;
62
+ }
63
+ else if (result.status >= 400 && result.status < 500 && result.status !== 429) {
64
+ return result;
65
+ }
66
+ else {
67
+ lastPollingIssue = `status endpoint returned HTTP ${result.status}`;
68
+ }
69
+ }
70
+ catch (error) {
71
+ lastPollingIssue = error instanceof Error ? error.message : String(error);
72
+ }
73
+ const remaining = deadline - now();
74
+ if (remaining <= 0)
75
+ break;
76
+ await sleep(Math.min(pollIntervalMs, remaining));
77
+ }
78
+ return runningResponse(lastSuccessfulStatus?.body || started.body, reportId, generationId, lastPollingIssue);
79
+ }
80
+ function completedResponse(result, reportId, generationId) {
81
+ const root = parseRecord(result.body);
82
+ const payload = parsePayloadRecord(root) || {};
83
+ const file = asRecord(payload.file);
84
+ payload.reportId = reportId;
85
+ payload.generationId = generationId;
86
+ payload.fileRecordId = generationId;
87
+ payload.status = "COMPLETED";
88
+ if (file) {
89
+ if (typeof file.fileName === "string")
90
+ payload.fileName = file.fileName;
91
+ if (typeof file.path === "string")
92
+ payload.downloadUrl = file.path;
93
+ }
94
+ setPayload(root, payload);
95
+ return { status: result.status, body: JSON.stringify(root) };
96
+ }
97
+ function runningResponse(sourceBody, reportId, generationId, pollingIssue) {
98
+ const root = parseRecord(sourceBody);
99
+ const payload = parsePayloadRecord(root) || {};
100
+ payload.reportId = reportId;
101
+ payload.generationId = generationId;
102
+ payload.fileRecordId = generationId;
103
+ payload.status = "RUNNING";
104
+ payload.timedOut = true;
105
+ payload.retryWithSameIdempotencyKey = true;
106
+ payload.message = "Report generation is still running; call cbam_report_generate again with the same idempotencyKey to continue waiting.";
107
+ if (pollingIssue)
108
+ payload.pollingWarning = pollingIssue;
109
+ setPayload(root, payload);
110
+ return { status: 200, body: JSON.stringify(root) };
111
+ }
112
+ function failureResponse(sourceBody, httpStatus, code, message, reportId, generationId, retryable = false, sourcePayload) {
113
+ const root = parseRecord(sourceBody);
114
+ root.data = {
115
+ success: false,
116
+ status: "FAILED",
117
+ message,
118
+ data: {
119
+ ...(sourcePayload || {}),
120
+ reportId,
121
+ generationId,
122
+ fileRecordId: generationId,
123
+ status: "FAILED",
124
+ },
125
+ error: {
126
+ code,
127
+ resourceId: generationId,
128
+ retryable,
129
+ },
130
+ };
131
+ return { status: httpStatus, body: JSON.stringify(root) };
132
+ }
133
+ function parseRecord(body) {
134
+ try {
135
+ return asRecord(JSON.parse(body)) || {};
136
+ }
137
+ catch {
138
+ return {};
139
+ }
140
+ }
141
+ function parsePayload(body) {
142
+ return parsePayloadRecord(parseRecord(body));
143
+ }
144
+ function parsePayloadRecord(root) {
145
+ const envelope = asRecord(root.data);
146
+ return asRecord(envelope?.data);
147
+ }
148
+ function setPayload(root, payload) {
149
+ const envelope = asRecord(root.data) || {};
150
+ envelope.data = payload;
151
+ root.data = envelope;
152
+ }
153
+ function asRecord(value) {
154
+ return value !== null && typeof value === "object" && !Array.isArray(value)
155
+ ? value
156
+ : undefined;
157
+ }
158
+ function idValue(value) {
159
+ if (typeof value === "number" && Number.isSafeInteger(value) && value > 0)
160
+ return value;
161
+ if (typeof value === "string" && /^\d+$/.test(value))
162
+ return value;
163
+ return undefined;
164
+ }
165
+ function stringValue(value) {
166
+ return typeof value === "string" && value.trim() ? value.trim() : undefined;
167
+ }
168
+ function positiveNumber(value, fallback) {
169
+ return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : fallback;
170
+ }
171
+ function nonNegativeNumber(value, fallback) {
172
+ return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : fallback;
173
+ }
174
+ //# sourceMappingURL=cbam-report-generation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cbam-report-generation.js","sourceRoot":"","sources":["../src/cbam-report-generation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAcpD,MAAM,gBAAgB,GAAG,OAAO,CAAC;AACjC,MAAM,qBAAqB,GAAG,KAAK,CAAC;AAEpC,MAAM,CAAC,MAAM,wBAAwB,GAAG,OAAO,CAAC;AAChD,MAAM,CAAC,MAAM,uBAAuB,GAAG,OAAO,CAAC;AAC/C,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,CAAC;AAChD,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;AAIhD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,OAAwB,EACxB,UAG6B,EAC7B,UAAiC,EAAE;IAEnC,MAAM,cAAc,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,MAAM,YAAY,GAAG,OAAO,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;IAC3D,MAAM,QAAQ,GAAG,OAAO,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;IACnD,IAAI,YAAY,KAAK,SAAS,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QACzD,OAAO,eAAe,CACpB,OAAO,CAAC,IAAI,EACZ,GAAG,EACH,oCAAoC,EACpC,iEAAiE,EACjE,QAAQ,EACR,YAAY,EACZ,KAAK,CACN,CAAC;IACJ,CAAC;IAED,MAAM,GAAG,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AAa,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IACxF,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACnE,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IACjC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9E,CAAC;AAED,SAAS,cAAc,CAAC,KAAyB,EAAE,QAAgB;IACjE,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC7F,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAyB,EAAE,QAAgB;IACpE,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC9F,CAAC"}
package/dist/client.d.ts CHANGED
@@ -11,6 +11,10 @@ export declare class Client {
11
11
  status: number;
12
12
  body: string;
13
13
  }>;
14
+ postOnceWithExactTimeout(path: string, sessionId: string, jsonBody: unknown, timeoutSeconds: number): Promise<{
15
+ status: number;
16
+ body: string;
17
+ }>;
14
18
  postMultipart(path: string, sessionId: string, filePath: string, fields: Record<string, unknown>): Promise<{
15
19
  status: number;
16
20
  body: string;
package/dist/client.js CHANGED
@@ -10,10 +10,12 @@ export class Client {
10
10
  constructor(config) {
11
11
  this.config = config;
12
12
  }
13
- async request(method, path, sessionId, body, query, contentType, timeoutSeconds, maxRetries) {
13
+ async request(method, path, sessionId, body, query, contentType, timeoutSeconds, maxRetries, exactTimeout = false) {
14
14
  if (!path.startsWith("/"))
15
15
  path = "/" + path;
16
- const effectiveTimeoutSeconds = Math.max(this.config.timeout, timeoutSeconds || 0);
16
+ const effectiveTimeoutSeconds = exactTimeout && typeof timeoutSeconds === "number" && timeoutSeconds > 0
17
+ ? timeoutSeconds
18
+ : Math.max(this.config.timeout, timeoutSeconds || 0);
17
19
  const effectiveMaxRetries = typeof maxRetries === "number" && Number.isInteger(maxRetries) && maxRetries >= 0
18
20
  ? maxRetries
19
21
  : defaultMaxRetries;
@@ -54,7 +56,7 @@ export class Client {
54
56
  method,
55
57
  headers,
56
58
  body,
57
- signal: AbortSignal.timeout(effectiveTimeoutSeconds * 1000),
59
+ signal: AbortSignal.timeout(Math.max(1, Math.ceil(effectiveTimeoutSeconds * 1000))),
58
60
  });
59
61
  const text = await resp.text();
60
62
  const durationMs = Date.now() - startedAt;
@@ -117,6 +119,9 @@ export class Client {
117
119
  async post(path, sessionId, jsonBody, timeoutSeconds, maxRetries) {
118
120
  return this.request("POST", path, sessionId, JSON.stringify(jsonBody), undefined, "application/json;charset=utf-8", timeoutSeconds, maxRetries);
119
121
  }
122
+ async postOnceWithExactTimeout(path, sessionId, jsonBody, timeoutSeconds) {
123
+ return this.request("POST", path, sessionId, JSON.stringify(jsonBody), undefined, "application/json;charset=utf-8", timeoutSeconds, 0, true);
124
+ }
120
125
  async postMultipart(path, sessionId, filePath, fields) {
121
126
  const filename = typeof fields.filename === "string" && fields.filename.trim()
122
127
  ? fields.filename