@carbonstopper/agent-mcp 0.1.22 → 0.1.24
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/README.md +197 -5
- package/dist/apipath.d.ts +14 -0
- package/dist/apipath.js +15 -0
- package/dist/apipath.js.map +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +17 -11
- package/dist/client.js.map +1 -1
- package/dist/logger.d.ts +1 -0
- package/dist/logger.js +152 -0
- package/dist/logger.js.map +1 -1
- package/dist/server.js +20 -5
- package/dist/server.js.map +1 -1
- package/dist/tools.d.ts +5 -2
- package/dist/tools.js +344 -3
- package/dist/tools.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +3 -1
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,6 +60,8 @@ 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` is a synchronous long-running operation and always uses at least 120 seconds; a larger `CARBONSTOP_TIMEOUT` value also applies to that tool. It is never automatically retried by the MCP server: timeout, network, HTTP 429, or HTTP 5xx failures are returned immediately so the report API is not called twice. Configure the Agent MCP client, reverse proxy, and gateway timeouts above the report timeout.
|
|
64
|
+
|
|
63
65
|
### Streamable HTTP
|
|
64
66
|
|
|
65
67
|
Use Streamable HTTP when a LangChain/LangGraph Agent should call the MCP server by URL instead of spawning a local `npx` process.
|
|
@@ -115,7 +117,7 @@ Default settings are `CARBONSTOP_LOG_LEVEL=info` and `CARBONSTOP_LOG_BODY=false`
|
|
|
115
117
|
|
|
116
118
|
Logged events include:
|
|
117
119
|
|
|
118
|
-
- `tool_call_start`, `tool_call_success`, `tool_call_backend_error`, `tool_call_error`
|
|
120
|
+
- `tool_call_start`, `tool_call_success`, `tool_call_partial_success`, `tool_call_batch_failed`, `tool_call_backend_error`, `tool_call_error`
|
|
119
121
|
- `backend_request`, `backend_response`, `backend_retry`, `backend_error`
|
|
120
122
|
- `mcp_http_request`, `mcp_http_not_found`, `mcp_http_unauthorized`, `mcp_http_error`
|
|
121
123
|
|
|
@@ -198,7 +200,7 @@ For local debugging against a non-default gateway, add:
|
|
|
198
200
|
|
|
199
201
|
## Available Tools
|
|
200
202
|
|
|
201
|
-
Only Agent-facing
|
|
203
|
+
Only Agent-facing product carbon, enterprise carbon, factor search, and unit dictionary tools are exposed in this release.
|
|
202
204
|
|
|
203
205
|
| Tool | Description |
|
|
204
206
|
| --- | --- |
|
|
@@ -218,6 +220,20 @@ Only Agent-facing modeling, report generation/detail, factor search, and unit di
|
|
|
218
220
|
| `report_generate` | Generate a product carbon report. Requires `accountId` and `idempotencyKey`. |
|
|
219
221
|
| `report_regenerate` | Regenerate an existing product carbon report. Requires `reportId` and `idempotencyKey`. |
|
|
220
222
|
| `report_detail` | Get product carbon report detail and latest report URL. |
|
|
223
|
+
| `company_org_subject_query` | List existing enterprise carbon organization subjects. |
|
|
224
|
+
| `company_org_subject_batch_add` | Batch create or match organization subjects. Requires `idempotencyKey`. |
|
|
225
|
+
| `company_org_subject_batch_update` | Batch rename organization subjects. Requires `idempotencyKey`. |
|
|
226
|
+
| `enterprise_computation_exists` | Check whether enterprise carbon accounting exists for a target year. |
|
|
227
|
+
| `enterprise_computation_create_or_update` | Create or initialize yearly enterprise carbon accounting. Requires `year`, `orgList`, and `idempotencyKey`. |
|
|
228
|
+
| `enterprise_computation_batch_add` | Add subjects to an existing yearly enterprise carbon accounting. Requires `year`, `orgList`, and `idempotencyKey`. |
|
|
229
|
+
| `enterprise_computation_batch_delete` | Delete subject-year computations by `computationIdList`. Requires `idempotencyKey`. |
|
|
230
|
+
| `enterprise_computation_update_base_info` | Update enterprise accounting base settings such as GWP or period type. Requires `year` and `idempotencyKey`. |
|
|
231
|
+
| `enterprise_computation_detail` | Get enterprise accounting detail, including `computationId`, existing sources, and `sourceId`. |
|
|
232
|
+
| `enterprise_report_org_tree` | Get reportable enterprise organization tree nodes for a year. |
|
|
233
|
+
| `enterprise_report_generate` | Generate one or more enterprise carbon Word/Excel report versions. Requires `versionTypeList`, `calculatePeriod`, `orgId`, and `idempotencyKey`; waits at least 120 seconds for the backend and does not automatically retry failures. |
|
|
234
|
+
| `enterprise_emission_batch_save` | Pure-insert enterprise emission sources. Do not pass `sourceId`. Every source requires a request-unique `clientSourceKey`. Requires `year`, `orgList`, and `idempotencyKey`. |
|
|
235
|
+
| `enterprise_emission_batch_update` | Batch update existing enterprise emission sources. Requires exact `sourceId` from detail. Do not send `emissionQuantity`; the backend recalculates it. |
|
|
236
|
+
| `enterprise_emission_batch_delete` | Batch delete enterprise emission sources by `sourceIdList`. Requires `idempotencyKey`. |
|
|
221
237
|
|
|
222
238
|
Temporarily hidden tools:
|
|
223
239
|
|
|
@@ -245,6 +261,56 @@ Use the product carbon modeling tools as follows:
|
|
|
245
261
|
- `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.
|
|
246
262
|
- `unit_list`: query available units before `modeling_execute_structured`, then use returned `dictLabel` values as `unitName`.
|
|
247
263
|
|
|
264
|
+
### Enterprise Carbon Tool Selection
|
|
265
|
+
|
|
266
|
+
Use the enterprise carbon tools in this order:
|
|
267
|
+
|
|
268
|
+
1. `company_org_subject_query`: list existing organization subjects and match the user's subject name.
|
|
269
|
+
2. `enterprise_computation_exists`: check whether the target year already has enterprise carbon accounting.
|
|
270
|
+
3. If the year has no accounting, call `enterprise_computation_create_or_update` with selected or newly created subjects.
|
|
271
|
+
4. If the year already exists but the user wants to add a new subject, call `company_org_subject_batch_add` when needed, then `enterprise_computation_batch_add`.
|
|
272
|
+
5. If the user wants to change GWP or period type, call `enterprise_computation_update_base_info`.
|
|
273
|
+
6. Call `enterprise_computation_detail` before source maintenance. Use its returned `computationId` and `sourceId`; do not guess ids by names.
|
|
274
|
+
7. Add new sources with `enterprise_emission_batch_save`. This is pure insert; do not pass `sourceId`. Generate a non-empty `clientSourceKey` for every source and keep it unique across the entire request.
|
|
275
|
+
8. Update existing sources with `enterprise_emission_batch_update`. Every source item must include `sourceId`. Do not send `emissionQuantity`; the backend recalculates it from activity data, units, factor information, and `gasList`.
|
|
276
|
+
9. Delete sources with `enterprise_emission_batch_delete`. Use exact `sourceIdList` from detail and require user confirmation when the action is destructive.
|
|
277
|
+
10. For reports, call `enterprise_report_org_tree` first, then call `enterprise_report_generate` with a valid `orgId`.
|
|
278
|
+
|
|
279
|
+
Enterprise unit rules:
|
|
280
|
+
|
|
281
|
+
- Call `unit_list` before creating or updating enterprise emission sources.
|
|
282
|
+
- Use `unit_list.factorUnitM[].dictLabel` as `activityUnit` and custom factor denominator `factorUnitM`.
|
|
283
|
+
- Use `factorUnit` values such as `kgCO2e`, `kgCO2`, `kgCH4`, `kgN2O`, `kgSF6`, or other backend-supported numerator units.
|
|
284
|
+
- Pass `unitConver` only when the Agent has a confirmed conversion ratio. Otherwise omit it and let the backend infer or validate.
|
|
285
|
+
|
|
286
|
+
Enterprise batch result rules:
|
|
287
|
+
|
|
288
|
+
- MCP/HTTP success does not mean every source row succeeded. The backend response is returned unchanged.
|
|
289
|
+
- For `enterprise_emission_batch_save`, always inspect `data.successCount`, `data.failCount`, and `data.orgList[].sourceList[]`.
|
|
290
|
+
- For `enterprise_emission_batch_update`, always inspect `data.successCount`, `data.failCount`, and `data.computationList[].sourceList[]`.
|
|
291
|
+
- Inspect each source result's `clientSourceKey`, `index`, `sourceId`, `success`, `operation`, and `errorMsg`.
|
|
292
|
+
- Only report complete success when `failCount=0`. When correcting failed rows, submit only the corrected failed rows as a new business action with a new `idempotencyKey`; reuse the original key only when retrying the unchanged original request.
|
|
293
|
+
|
|
294
|
+
Enterprise report dictionaries:
|
|
295
|
+
|
|
296
|
+
The code fields below accept numbers or numeric strings. MCP normalizes numeric strings to numbers before calling the Java service.
|
|
297
|
+
|
|
298
|
+
| Field | Code | Meaning |
|
|
299
|
+
| --- | --- | --- |
|
|
300
|
+
| `versionTypeList[]` | `1` | GHG summary report, Word |
|
|
301
|
+
| `versionTypeList[]` | `2` | GHG full report, Word |
|
|
302
|
+
| `versionTypeList[]` | `3` | GHG inventory, Excel |
|
|
303
|
+
| `versionTypeList[]` | `4` | ISO summary report, Word |
|
|
304
|
+
| `versionTypeList[]` | `5` | ISO full report, Word |
|
|
305
|
+
| `versionTypeList[]` | `6` | ISO inventory, Excel |
|
|
306
|
+
| `languageType` | `1` | Chinese, default |
|
|
307
|
+
| `languageType` | `2` | English |
|
|
308
|
+
| `timeType` | `0` | Annual, default |
|
|
309
|
+
| `timeType` | `1` | Quarterly |
|
|
310
|
+
| `timeType` | `2` | Monthly |
|
|
311
|
+
|
|
312
|
+
The report response `fileList` is passed through unchanged. Each `fileList[].path` is the backend-provided persistent link and is not converted to a workspace `fileId`.
|
|
313
|
+
|
|
248
314
|
## Tool Request Shape
|
|
249
315
|
|
|
250
316
|
The MCP schema only exposes fields the Agent should fill. Do not pass platform, confirmation, or unrelated id fields unless they are listed for the selected tool.
|
|
@@ -254,6 +320,131 @@ Write tools accept optional trace fields:
|
|
|
254
320
|
- `messageId`: current Agent message id, used to associate business records with the current conversation message.
|
|
255
321
|
- `traceId`: Agent run trace id.
|
|
256
322
|
- `taskId`: Agent task or graph node id.
|
|
323
|
+
- `eventId`: Agent event id, mainly used by enterprise carbon trace records.
|
|
324
|
+
|
|
325
|
+
### Enterprise Carbon Examples
|
|
326
|
+
|
|
327
|
+
Query subjects:
|
|
328
|
+
|
|
329
|
+
```json
|
|
330
|
+
{
|
|
331
|
+
"sessionId": "agent_xxx",
|
|
332
|
+
"messageId": "msg_xxx"
|
|
333
|
+
}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
Create yearly accounting:
|
|
337
|
+
|
|
338
|
+
```json
|
|
339
|
+
{
|
|
340
|
+
"sessionId": "agent_xxx",
|
|
341
|
+
"messageId": "msg_xxx",
|
|
342
|
+
"traceId": "run_xxx",
|
|
343
|
+
"taskId": "enterprise_create_node",
|
|
344
|
+
"year": 2025,
|
|
345
|
+
"timeType": 0,
|
|
346
|
+
"gwp": "2",
|
|
347
|
+
"idempotencyKey": "agent_xxx_enterprise_create_2025_v1",
|
|
348
|
+
"orgList": [
|
|
349
|
+
{
|
|
350
|
+
"orgName": "Beijing Office"
|
|
351
|
+
}
|
|
352
|
+
]
|
|
353
|
+
}
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
Get detail before source changes:
|
|
357
|
+
|
|
358
|
+
```json
|
|
359
|
+
{
|
|
360
|
+
"sessionId": "agent_xxx",
|
|
361
|
+
"messageId": "msg_xxx",
|
|
362
|
+
"year": 2025
|
|
363
|
+
}
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
Add enterprise emission sources:
|
|
367
|
+
|
|
368
|
+
```json
|
|
369
|
+
{
|
|
370
|
+
"sessionId": "agent_xxx",
|
|
371
|
+
"messageId": "msg_xxx",
|
|
372
|
+
"year": 2025,
|
|
373
|
+
"idempotencyKey": "agent_xxx_enterprise_source_add_v1",
|
|
374
|
+
"orgList": [
|
|
375
|
+
{
|
|
376
|
+
"computationId": 3001,
|
|
377
|
+
"computationPeriod": "2025",
|
|
378
|
+
"sourceList": [
|
|
379
|
+
{
|
|
380
|
+
"clientSourceKey": "src_001",
|
|
381
|
+
"name": "Purchased electricity",
|
|
382
|
+
"facility": "Beijing Office",
|
|
383
|
+
"ghgClassify": "Purchased electricity",
|
|
384
|
+
"activityData": "1000",
|
|
385
|
+
"activityUnit": "kWh",
|
|
386
|
+
"factorId": 9001
|
|
387
|
+
}
|
|
388
|
+
]
|
|
389
|
+
}
|
|
390
|
+
]
|
|
391
|
+
}
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
Update enterprise emission sources:
|
|
395
|
+
|
|
396
|
+
```json
|
|
397
|
+
{
|
|
398
|
+
"sessionId": "agent_xxx",
|
|
399
|
+
"messageId": "msg_xxx",
|
|
400
|
+
"year": 2025,
|
|
401
|
+
"idempotencyKey": "agent_xxx_enterprise_source_update_v1",
|
|
402
|
+
"computationList": [
|
|
403
|
+
{
|
|
404
|
+
"computationId": 3001,
|
|
405
|
+
"sourceList": [
|
|
406
|
+
{
|
|
407
|
+
"sourceId": 5001,
|
|
408
|
+
"name": "Purchased electricity",
|
|
409
|
+
"facility": "Beijing Office",
|
|
410
|
+
"ghgClassify": "Purchased electricity",
|
|
411
|
+
"activityData": "1200",
|
|
412
|
+
"activityUnit": "kWh",
|
|
413
|
+
"factorId": 9001
|
|
414
|
+
}
|
|
415
|
+
]
|
|
416
|
+
}
|
|
417
|
+
]
|
|
418
|
+
}
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
Delete enterprise emission sources:
|
|
422
|
+
|
|
423
|
+
```json
|
|
424
|
+
{
|
|
425
|
+
"sessionId": "agent_xxx",
|
|
426
|
+
"messageId": "msg_xxx",
|
|
427
|
+
"year": 2025,
|
|
428
|
+
"idempotencyKey": "agent_xxx_enterprise_source_delete_v1",
|
|
429
|
+
"sourceIdList": [5001]
|
|
430
|
+
}
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
Generate enterprise report:
|
|
434
|
+
|
|
435
|
+
```json
|
|
436
|
+
{
|
|
437
|
+
"sessionId": "agent_xxx",
|
|
438
|
+
"messageId": "msg_xxx",
|
|
439
|
+
"idempotencyKey": "agent_xxx_enterprise_report_2025_v1",
|
|
440
|
+
"versionTypeList": [2, 3],
|
|
441
|
+
"languageType": 1,
|
|
442
|
+
"timeType": 0,
|
|
443
|
+
"calculatePeriod": "2025",
|
|
444
|
+
"orgId": 1001,
|
|
445
|
+
"reportName": "2025 Enterprise Carbon Report"
|
|
446
|
+
}
|
|
447
|
+
```
|
|
257
448
|
|
|
258
449
|
### `modeling_re_modeling`
|
|
259
450
|
|
|
@@ -682,7 +873,8 @@ For transport factors, the Agent should use transport-specific keywords, not gen
|
|
|
682
873
|
|
|
683
874
|
```json
|
|
684
875
|
{
|
|
685
|
-
"sessionId": "agent_xxx"
|
|
876
|
+
"sessionId": "agent_xxx",
|
|
877
|
+
"lang": "zh"
|
|
686
878
|
}
|
|
687
879
|
```
|
|
688
880
|
|
|
@@ -690,12 +882,12 @@ The backend returns the unit dictionary in `factorUnitM`.
|
|
|
690
882
|
|
|
691
883
|
Important fields:
|
|
692
884
|
|
|
693
|
-
- `dictLabel`: unit display name. Use this value as `unitName`
|
|
885
|
+
- `dictLabel`: unit display name. Use this value as product carbon `unitName`, enterprise carbon `activityUnit`, or enterprise custom factor denominator `factorUnitM`.
|
|
694
886
|
- `dictValue`: unit code.
|
|
695
887
|
- `id`: unit dictionary id.
|
|
696
888
|
- `sourceName`: unit category, such as mass, energy, volume, quantity, or distance.
|
|
697
889
|
|
|
698
|
-
Before calling `modeling_execute_structured
|
|
890
|
+
Before calling product carbon `modeling_execute_structured` or enterprise carbon emission source save/update tools, the Agent should call `unit_list` and choose valid units from the returned dictionary. Product emission source units and enterprise `activityUnit` can use the full dictionary. Product transport activity `unitName` should use mass units only; transport distance remains kilometer.
|
|
699
891
|
|
|
700
892
|
### `report_generate`
|
|
701
893
|
|
package/dist/apipath.d.ts
CHANGED
|
@@ -26,3 +26,17 @@ export declare const FactorSearch: () => string;
|
|
|
26
26
|
export declare const KnowledgeSearch: () => string;
|
|
27
27
|
export declare const QueryFactorListAgent: () => string;
|
|
28
28
|
export declare const QueryUnitListAgent: () => string;
|
|
29
|
+
export declare const EnterpriseComputationExists: () => string;
|
|
30
|
+
export declare const EnterpriseComputationCreateOrUpdate: () => string;
|
|
31
|
+
export declare const EnterpriseComputationBatchAdd: () => string;
|
|
32
|
+
export declare const EnterpriseComputationBatchDelete: () => string;
|
|
33
|
+
export declare const EnterpriseComputationUpdateBaseInfo: () => string;
|
|
34
|
+
export declare const EnterpriseComputationDetail: () => string;
|
|
35
|
+
export declare const EnterpriseReportGenerate: () => string;
|
|
36
|
+
export declare const EnterpriseReportOrgTree: () => string;
|
|
37
|
+
export declare const EnterpriseEmissionBatchSave: () => string;
|
|
38
|
+
export declare const EnterpriseEmissionBatchUpdate: () => string;
|
|
39
|
+
export declare const EnterpriseEmissionBatchDelete: () => string;
|
|
40
|
+
export declare const CompanyOrgSubjectQuery: () => string;
|
|
41
|
+
export declare const CompanyOrgSubjectBatchAdd: () => string;
|
|
42
|
+
export declare const CompanyOrgSubjectBatchUpdate: () => string;
|
package/dist/apipath.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const aiPrefix = "/ai";
|
|
2
2
|
const footprint3Prefix = "/footprint3";
|
|
3
3
|
const managementPrefix = "/management";
|
|
4
|
+
const enterpriseComputationPrefix = "/enterprise";
|
|
4
5
|
export const SessionContext = () => `${aiPrefix}/agent/internal/platform/sessionContext`;
|
|
5
6
|
export const ProjectMemoryGet = () => `${aiPrefix}/agent/internal/platform/project-memory/get`;
|
|
6
7
|
export const ProjectMemoryPatch = () => `${aiPrefix}/agent/internal/platform/project-memory/patch`;
|
|
@@ -29,4 +30,18 @@ export const FactorSearch = () => `${footprint3Prefix}/agent/internal/skills/fac
|
|
|
29
30
|
export const KnowledgeSearch = () => `${footprint3Prefix}/agent/internal/skills/knowledge/search`;
|
|
30
31
|
export const QueryFactorListAgent = () => `${managementPrefix}/system/website/queryFactorListAgent`;
|
|
31
32
|
export const QueryUnitListAgent = () => `${managementPrefix}/system/website/queryUnitListAgent`;
|
|
33
|
+
export const EnterpriseComputationExists = () => `${enterpriseComputationPrefix}/agent/computation/exists`;
|
|
34
|
+
export const EnterpriseComputationCreateOrUpdate = () => `${enterpriseComputationPrefix}/agent/computation/createOrUpdate`;
|
|
35
|
+
export const EnterpriseComputationBatchAdd = () => `${enterpriseComputationPrefix}/agent/computation/batchAdd`;
|
|
36
|
+
export const EnterpriseComputationBatchDelete = () => `${enterpriseComputationPrefix}/agent/computation/batchDelete`;
|
|
37
|
+
export const EnterpriseComputationUpdateBaseInfo = () => `${enterpriseComputationPrefix}/agent/computation/updateBaseInfo`;
|
|
38
|
+
export const EnterpriseComputationDetail = () => `${enterpriseComputationPrefix}/agent/computation/detail`;
|
|
39
|
+
export const EnterpriseReportGenerate = () => `${enterpriseComputationPrefix}/agent/report/generate`;
|
|
40
|
+
export const EnterpriseReportOrgTree = () => `${enterpriseComputationPrefix}/agent/report/orgTree`;
|
|
41
|
+
export const EnterpriseEmissionBatchSave = () => `${enterpriseComputationPrefix}/agent/emission/batchSave`;
|
|
42
|
+
export const EnterpriseEmissionBatchUpdate = () => `${enterpriseComputationPrefix}/agent/emission/batchUpdate`;
|
|
43
|
+
export const EnterpriseEmissionBatchDelete = () => `${enterpriseComputationPrefix}/agent/emission/batchDelete`;
|
|
44
|
+
export const CompanyOrgSubjectQuery = () => `${managementPrefix}/companyOrg/agent/orgNames`;
|
|
45
|
+
export const CompanyOrgSubjectBatchAdd = () => `${managementPrefix}/companyOrg/agent/batchAdd`;
|
|
46
|
+
export const CompanyOrgSubjectBatchUpdate = () => `${managementPrefix}/companyOrg/agent/batchUpdate`;
|
|
32
47
|
//# sourceMappingURL=apipath.js.map
|
package/dist/apipath.js.map
CHANGED
|
@@ -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,aAAa,CAAC;
|
|
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,aAAa,CAAC;AACvC,MAAM,2BAA2B,GAAG,aAAa,CAAC;AAElD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-7,7 +7,7 @@ export declare class Client {
|
|
|
7
7
|
status: number;
|
|
8
8
|
body: string;
|
|
9
9
|
}>;
|
|
10
|
-
post(path: string, sessionId: string, jsonBody?: unknown): Promise<{
|
|
10
|
+
post(path: string, sessionId: string, jsonBody?: unknown, timeoutSeconds?: number, maxRetries?: number): Promise<{
|
|
11
11
|
status: number;
|
|
12
12
|
body: string;
|
|
13
13
|
}>;
|
package/dist/client.js
CHANGED
|
@@ -3,16 +3,20 @@ import { Version } from "./version.js";
|
|
|
3
3
|
import { readFile } from "node:fs/promises";
|
|
4
4
|
import { basename } from "node:path";
|
|
5
5
|
const userAgent = `carbonstop-agent-mcp/${Version}`;
|
|
6
|
-
const
|
|
6
|
+
const defaultMaxRetries = 3;
|
|
7
7
|
const baseBackoff = 1000;
|
|
8
8
|
export class Client {
|
|
9
9
|
config;
|
|
10
10
|
constructor(config) {
|
|
11
11
|
this.config = config;
|
|
12
12
|
}
|
|
13
|
-
async request(method, path, sessionId, body, query, contentType) {
|
|
13
|
+
async request(method, path, sessionId, body, query, contentType, timeoutSeconds, maxRetries) {
|
|
14
14
|
if (!path.startsWith("/"))
|
|
15
15
|
path = "/" + path;
|
|
16
|
+
const effectiveTimeoutSeconds = Math.max(this.config.timeout, timeoutSeconds || 0);
|
|
17
|
+
const effectiveMaxRetries = typeof maxRetries === "number" && Number.isInteger(maxRetries) && maxRetries >= 0
|
|
18
|
+
? maxRetries
|
|
19
|
+
: defaultMaxRetries;
|
|
16
20
|
const u = new URL(this.config.baseURL + path);
|
|
17
21
|
if (query) {
|
|
18
22
|
for (const [k, v] of Object.entries(query)) {
|
|
@@ -21,7 +25,7 @@ export class Client {
|
|
|
21
25
|
}
|
|
22
26
|
}
|
|
23
27
|
let lastErr = null;
|
|
24
|
-
for (let attempt = 0; attempt <=
|
|
28
|
+
for (let attempt = 0; attempt <= effectiveMaxRetries; attempt++) {
|
|
25
29
|
const attemptNumber = attempt + 1;
|
|
26
30
|
if (attempt > 0) {
|
|
27
31
|
const backoff = Math.pow(2, attempt - 1) * baseBackoff;
|
|
@@ -34,7 +38,8 @@ export class Client {
|
|
|
34
38
|
path,
|
|
35
39
|
sessionId,
|
|
36
40
|
attempt: attemptNumber,
|
|
37
|
-
timeoutSeconds:
|
|
41
|
+
timeoutSeconds: effectiveTimeoutSeconds,
|
|
42
|
+
maxRetries: effectiveMaxRetries,
|
|
38
43
|
});
|
|
39
44
|
const headers = {
|
|
40
45
|
"X-Agent-Internal-Key": this.config.agentInternalKey,
|
|
@@ -49,7 +54,7 @@ export class Client {
|
|
|
49
54
|
method,
|
|
50
55
|
headers,
|
|
51
56
|
body,
|
|
52
|
-
signal: AbortSignal.timeout(
|
|
57
|
+
signal: AbortSignal.timeout(effectiveTimeoutSeconds * 1000),
|
|
53
58
|
});
|
|
54
59
|
const text = await resp.text();
|
|
55
60
|
const durationMs = Date.now() - startedAt;
|
|
@@ -65,7 +70,7 @@ export class Client {
|
|
|
65
70
|
log(resp.status >= 400 ? "warn" : "info", "backend_response", responseFields);
|
|
66
71
|
if (resp.status === 429 || resp.status >= 500) {
|
|
67
72
|
lastErr = new Error(`retryable server error: ${resp.status}`);
|
|
68
|
-
if (attempt <
|
|
73
|
+
if (attempt < effectiveMaxRetries) {
|
|
69
74
|
log("warn", "backend_retry", {
|
|
70
75
|
method,
|
|
71
76
|
path,
|
|
@@ -74,14 +79,15 @@ export class Client {
|
|
|
74
79
|
attempt: attemptNumber,
|
|
75
80
|
nextAttempt: attemptNumber + 1,
|
|
76
81
|
});
|
|
82
|
+
continue;
|
|
77
83
|
}
|
|
78
|
-
|
|
84
|
+
return { status: resp.status, body: text };
|
|
79
85
|
}
|
|
80
86
|
return { status: resp.status, body: text };
|
|
81
87
|
}
|
|
82
88
|
catch (e) {
|
|
83
89
|
lastErr = e;
|
|
84
|
-
if (attempt <
|
|
90
|
+
if (attempt < effectiveMaxRetries) {
|
|
85
91
|
log("warn", "backend_retry", {
|
|
86
92
|
method,
|
|
87
93
|
path,
|
|
@@ -103,13 +109,13 @@ export class Client {
|
|
|
103
109
|
continue;
|
|
104
110
|
}
|
|
105
111
|
}
|
|
106
|
-
throw new Error(`request failed after ${
|
|
112
|
+
throw new Error(`request failed after ${effectiveMaxRetries + 1} attempt(s): ${lastErr?.message}`);
|
|
107
113
|
}
|
|
108
114
|
async get(path, sessionId, query) {
|
|
109
115
|
return this.request("GET", path, sessionId, undefined, query);
|
|
110
116
|
}
|
|
111
|
-
async post(path, sessionId, jsonBody) {
|
|
112
|
-
return this.request("POST", path, sessionId, JSON.stringify(jsonBody), undefined, "application/json;charset=utf-8");
|
|
117
|
+
async post(path, sessionId, jsonBody, timeoutSeconds, maxRetries) {
|
|
118
|
+
return this.request("POST", path, sessionId, JSON.stringify(jsonBody), undefined, "application/json;charset=utf-8", timeoutSeconds, maxRetries);
|
|
113
119
|
}
|
|
114
120
|
async postMultipart(path, sessionId, filePath, fields) {
|
|
115
121
|
const filename = typeof fields.filename === "string" && fields.filename.trim()
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,MAAM,SAAS,GAAG,wBAAwB,OAAO,EAAE,CAAC;AACpD,MAAM,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,k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OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE;YACnD,CAAC,CAAC,MAAM,CAAC,IAAI;YACb,CAAC,CAAC,0BAA0B,CAAC;QACjC,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACvC,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC5B,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,IAAI,CAAC,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC;QAEjF,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAClD,IAAI,GAAG,KAAK,UAAU,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;gBAAE,SAAS;YAC1E,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC9B,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;YAC1C,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YAClC,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IACrD,CAAC;CACF"}
|
package/dist/logger.d.ts
CHANGED
|
@@ -5,5 +5,6 @@ export declare function truncateText(value: string, maxLength?: number): string;
|
|
|
5
5
|
export declare function errorMessage(err: unknown): string;
|
|
6
6
|
export declare function summarizeArgs(args: Record<string, unknown>): Record<string, unknown>;
|
|
7
7
|
export declare function summarizeResponseBody(body: string, includePreview?: boolean): Record<string, unknown>;
|
|
8
|
+
export declare function responseBatchResult(body: string): Record<string, unknown> | undefined;
|
|
8
9
|
export declare function responseBusinessError(body: string): boolean;
|
|
9
10
|
export {};
|