@continuumdao/ctm-mpc-defi 0.2.10 → 0.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/agent/catalog.cjs +98 -46
  2. package/dist/agent/catalog.cjs.map +1 -1
  3. package/dist/agent/catalog.d.ts +900 -339
  4. package/dist/agent/catalog.js +98 -46
  5. package/dist/agent/catalog.js.map +1 -1
  6. package/dist/agent/skills/morpho/SKILL.md +26 -3
  7. package/dist/chains/evm/index.cjs +1 -1
  8. package/dist/chains/evm/index.cjs.map +1 -1
  9. package/dist/chains/evm/index.js +1 -1
  10. package/dist/chains/evm/index.js.map +1 -1
  11. package/dist/core/index.cjs +1 -1
  12. package/dist/core/index.cjs.map +1 -1
  13. package/dist/core/index.d.ts +1 -1
  14. package/dist/core/index.js +1 -1
  15. package/dist/core/index.js.map +1 -1
  16. package/dist/index.cjs +1 -1
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.js +1 -1
  19. package/dist/index.js.map +1 -1
  20. package/dist/protocols/evm/aave-v4/index.cjs +1 -1
  21. package/dist/protocols/evm/aave-v4/index.cjs.map +1 -1
  22. package/dist/protocols/evm/aave-v4/index.js +1 -1
  23. package/dist/protocols/evm/aave-v4/index.js.map +1 -1
  24. package/dist/protocols/evm/curve-dao/index.cjs +1 -1
  25. package/dist/protocols/evm/curve-dao/index.cjs.map +1 -1
  26. package/dist/protocols/evm/curve-dao/index.js +1 -1
  27. package/dist/protocols/evm/curve-dao/index.js.map +1 -1
  28. package/dist/protocols/evm/ethena/index.cjs +1 -1
  29. package/dist/protocols/evm/ethena/index.cjs.map +1 -1
  30. package/dist/protocols/evm/ethena/index.js +1 -1
  31. package/dist/protocols/evm/ethena/index.js.map +1 -1
  32. package/dist/protocols/evm/euler-v2/index.cjs +1 -1
  33. package/dist/protocols/evm/euler-v2/index.cjs.map +1 -1
  34. package/dist/protocols/evm/euler-v2/index.js +1 -1
  35. package/dist/protocols/evm/euler-v2/index.js.map +1 -1
  36. package/dist/protocols/evm/gmx/index.cjs +1 -1
  37. package/dist/protocols/evm/gmx/index.cjs.map +1 -1
  38. package/dist/protocols/evm/gmx/index.js +1 -1
  39. package/dist/protocols/evm/gmx/index.js.map +1 -1
  40. package/dist/protocols/evm/hyperliquid/index.cjs +1 -1
  41. package/dist/protocols/evm/hyperliquid/index.cjs.map +1 -1
  42. package/dist/protocols/evm/hyperliquid/index.js +1 -1
  43. package/dist/protocols/evm/hyperliquid/index.js.map +1 -1
  44. package/dist/protocols/evm/lido/index.cjs +1 -1
  45. package/dist/protocols/evm/lido/index.cjs.map +1 -1
  46. package/dist/protocols/evm/lido/index.js +1 -1
  47. package/dist/protocols/evm/lido/index.js.map +1 -1
  48. package/dist/protocols/evm/maple/index.cjs +1 -1
  49. package/dist/protocols/evm/maple/index.cjs.map +1 -1
  50. package/dist/protocols/evm/maple/index.js +1 -1
  51. package/dist/protocols/evm/maple/index.js.map +1 -1
  52. package/dist/protocols/evm/morpho/index.cjs +1 -1
  53. package/dist/protocols/evm/morpho/index.cjs.map +1 -1
  54. package/dist/protocols/evm/morpho/index.js +1 -1
  55. package/dist/protocols/evm/morpho/index.js.map +1 -1
  56. package/dist/protocols/evm/sky/index.cjs +1 -1
  57. package/dist/protocols/evm/sky/index.cjs.map +1 -1
  58. package/dist/protocols/evm/sky/index.js +1 -1
  59. package/dist/protocols/evm/sky/index.js.map +1 -1
  60. package/dist/protocols/evm/uniswap-v4/index.cjs +1 -1
  61. package/dist/protocols/evm/uniswap-v4/index.cjs.map +1 -1
  62. package/dist/protocols/evm/uniswap-v4/index.js +1 -1
  63. package/dist/protocols/evm/uniswap-v4/index.js.map +1 -1
  64. package/package.json +1 -1
@@ -416,6 +416,14 @@ var MULTISIGN_SUBMIT_OUTPUT_DOC = {
416
416
  requestId: {
417
417
  type: "string",
418
418
  description: "Sign request id from POST /multiSignRequest."
419
+ },
420
+ status: {
421
+ type: "string",
422
+ description: "submitted when POST succeeded \u2014 do not call the same build tool again."
423
+ },
424
+ followUp: {
425
+ type: "string",
426
+ description: "Lifecycle next steps (wait_for_sign_request_ready \u2192 agree \u2192 trigger \u2192 broadcast)."
419
427
  }
420
428
  }
421
429
  };
@@ -484,6 +492,22 @@ function withMultisignSubmitMcpMeta(description, followUp = MCP_MULTISIGN_SUBMIT
484
492
  followUp: [...followUp]
485
493
  };
486
494
  }
495
+ var MULTISIGN_SERVER_RESOLVED_KEYS = /* @__PURE__ */ new Set([
496
+ "keyGen",
497
+ "rpcUrl",
498
+ "executorAddress",
499
+ "chainDetail",
500
+ "customGasChainDetails"
501
+ ]);
502
+ function agentFacingMultisignJsonSchema(schema) {
503
+ const raw = zodSchemaToMcpJsonSchema(schema);
504
+ const prevRequired = Array.isArray(raw.required) ? [...raw.required] : [];
505
+ const agentRequired = prevRequired.filter((k) => !MULTISIGN_SERVER_RESOLVED_KEYS.has(k));
506
+ if (!agentRequired.includes("keyGenId")) {
507
+ agentRequired.unshift("keyGenId");
508
+ }
509
+ return { ...raw, required: agentRequired };
510
+ }
487
511
  function zodSchemaToMcpJsonSchema(schema) {
488
512
  const raw = zodToJsonSchema.zodToJsonSchema(schema, {
489
513
  target: "openApi3",
@@ -523,21 +547,31 @@ var chainDetailSchema = zod.z.object({
523
547
  "Optional gas config: { legacy?, gasLimit?, gasMultiplier?, gasPrice?, baseFee?, priorityFee?, baseFeeMultiplier? }."
524
548
  );
525
549
  var evmMultisignCommonInputSchema = zod.z.object({
526
- keyGen: keyGenSchema,
550
+ keyGenId: zod.z.string().min(1).optional().describe(
551
+ "KeyGen request id from get_preferred_key_gen / conversation context. MCP server resolves keyGen, executorAddress, rpcUrl, and chainDetail \u2014 agents must pass keyGenId only."
552
+ ),
553
+ keyGen: keyGenSchema.optional().describe("Server-filled from keyGenId. Agents must not pass keyGen."),
527
554
  purposeText: zod.z.string().min(1).describe(
528
555
  "Human-readable purpose for the sign request. Stored in bodyForSign.purpose (may be appended with an automatic batch suffix)."
529
556
  ),
530
- useCustomGas: zod.z.boolean().describe(
557
+ useCustomGas: zod.z.boolean().default(false).describe(
531
558
  "When true, apply Custom Gas Config from chainDetail / customGasChainDetails. Omitted baseFee/priorityFee is valid \u2014 builder uses live RPC fees; configured values are optional floors/multipliers. When false, use live RPC estimates only."
532
559
  ),
533
560
  chainId: zod.z.number().int().positive().describe("EVM chain id (decimal). Becomes destinationChainID on the sign request."),
534
- rpcUrl: zod.z.string().min(1).describe("HTTPS JSON-RPC URL for gas estimation, nonce, and allowance reads."),
535
- executorAddress: evmAddressSchema.describe(
536
- "MPC wallet address (from keyGen ethereumaddress) \u2014 tx sender for estimates and approvals."
537
- ),
538
- chainDetail: chainDetailSchema,
561
+ rpcUrl: zod.z.string().min(1).optional().describe("Server-filled from chain registry when keyGenId is set. Agents must not pass rpcUrl."),
562
+ executorAddress: evmAddressSchema.optional().describe("Server-filled MPC wallet from keyGenId. Agents must not pass executorAddress."),
563
+ chainDetail: chainDetailSchema.optional().describe("Server-filled gas row from chain registry when keyGenId is set."),
539
564
  customGasChainDetails: zod.z.record(zod.z.unknown()).optional().describe("Snapshot written to extraJSON.customGasChainDetails when useCustomGas is true.")
540
565
  });
566
+ function withMultisignKeySourceRefine(schema) {
567
+ return schema.refine(
568
+ (d) => Boolean(d.keyGenId?.trim()) || Boolean(d.keyGen?.pubkeyhex?.trim() && d.executorAddress?.trim() && d.rpcUrl?.trim()),
569
+ {
570
+ message: "keyGenId is required for MCP agents (or pass keyGen + executorAddress + rpcUrl for manual calls).",
571
+ path: ["keyGenId"]
572
+ }
573
+ );
574
+ }
541
575
  var multisignOutputSchema = zod.z.object({
542
576
  bodyForSign: zod.z.record(zod.z.unknown()).describe(
543
577
  "POST body fields without clientSig: keyList, pubKey, msgHash, msgRaw, destinationChainID, purpose, extraJSON, proposalTxParams (batch), messageHashes/messageRawBatch when N>1 txs."
@@ -585,18 +619,20 @@ var mcpUniswapV4CreateSwapOutputSchema = zod.z.object({
585
619
  gasFee: zod.z.string().optional()
586
620
  }).passthrough().describe("{ swap: TransactionRequest, requestId?, gasFee? }");
587
621
  var swapTxRequestSchema = jsonObjectSchema.describe("swap field from create_swap response (to, data, value)");
588
- var mcpUniswapV4BuildSwapMultisignInputSchema = evmMultisignCommonInputSchema.extend({
589
- tokenIn: evmAddressSchema.describe("Token in; 0x0 for native ETH"),
590
- swap: swapTxRequestSchema,
591
- createSwapResponse: zod.z.object({
622
+ var mcpUniswapV4BuildSwapMultisignInputSchema = withMultisignKeySourceRefine(
623
+ evmMultisignCommonInputSchema.extend({
624
+ tokenIn: evmAddressSchema.describe("Token in; 0x0 for native ETH"),
592
625
  swap: swapTxRequestSchema,
593
- requestId: zod.z.string().optional(),
594
- gasFee: zod.z.string().optional()
595
- }).passthrough().describe("Full create_swap response"),
596
- fullQuoteSnapshot: jsonObjectSchema.describe("Quote JSON used for the swap"),
597
- swapDeadlineUnix: zod.z.number().describe("Same deadline passed to create_swap"),
598
- slippagePercent: zod.z.number().optional().describe("Extra approve headroom for EXACT_OUTPUT")
599
- });
626
+ createSwapResponse: zod.z.object({
627
+ swap: swapTxRequestSchema,
628
+ requestId: zod.z.string().optional(),
629
+ gasFee: zod.z.string().optional()
630
+ }).passthrough().describe("Full create_swap response"),
631
+ fullQuoteSnapshot: jsonObjectSchema.describe("Quote JSON used for the swap"),
632
+ swapDeadlineUnix: zod.z.number().describe("Same deadline passed to create_swap"),
633
+ slippagePercent: zod.z.number().optional().describe("Extra approve headroom for EXACT_OUTPUT")
634
+ })
635
+ );
600
636
  var lpExistingPoolSchema = zod.z.object({
601
637
  token0Address: evmAddressSchema,
602
638
  token1Address: evmAddressSchema,
@@ -736,21 +772,27 @@ var lpBuildCommonSchema = {
736
772
  nativeWrapped: evmAddressSchema.optional(),
737
773
  poolReference: zod.z.string().optional()
738
774
  };
739
- var mcpUniswapV4BuildMintLiquidityMultisignInputSchema = evmMultisignCommonInputSchema.extend(
740
- lpBuildCommonSchema
775
+ var mcpUniswapV4BuildMintLiquidityMultisignInputSchema = withMultisignKeySourceRefine(
776
+ evmMultisignCommonInputSchema.extend(lpBuildCommonSchema)
777
+ );
778
+ var mcpUniswapV4BuildIncreaseLiquidityMultisignInputSchema = withMultisignKeySourceRefine(
779
+ evmMultisignCommonInputSchema.extend({
780
+ ...lpBuildCommonSchema,
781
+ nftTokenId: zod.z.union([zod.z.string(), zod.z.number()])
782
+ })
783
+ );
784
+ var mcpUniswapV4BuildDecreaseLiquidityMultisignInputSchema = withMultisignKeySourceRefine(
785
+ evmMultisignCommonInputSchema.extend({
786
+ ...lpBuildCommonSchema,
787
+ nftTokenId: zod.z.union([zod.z.string(), zod.z.number()])
788
+ })
789
+ );
790
+ var mcpUniswapV4BuildCollectFeesMultisignInputSchema = withMultisignKeySourceRefine(
791
+ evmMultisignCommonInputSchema.extend({
792
+ ...lpBuildCommonSchema,
793
+ nftTokenId: zod.z.union([zod.z.string(), zod.z.number()])
794
+ })
741
795
  );
742
- var mcpUniswapV4BuildIncreaseLiquidityMultisignInputSchema = evmMultisignCommonInputSchema.extend({
743
- ...lpBuildCommonSchema,
744
- nftTokenId: zod.z.union([zod.z.string(), zod.z.number()])
745
- });
746
- var mcpUniswapV4BuildDecreaseLiquidityMultisignInputSchema = evmMultisignCommonInputSchema.extend({
747
- ...lpBuildCommonSchema,
748
- nftTokenId: zod.z.union([zod.z.string(), zod.z.number()])
749
- });
750
- var mcpUniswapV4BuildCollectFeesMultisignInputSchema = evmMultisignCommonInputSchema.extend({
751
- ...lpBuildCommonSchema,
752
- nftTokenId: zod.z.union([zod.z.string(), zod.z.number()])
753
- });
754
796
  var mcpCurveDaoQuoteInputSchema = zod.z.object({
755
797
  chainId: zod.z.number().int().positive().describe("EVM chain id (rpcUrl resolved from get_chain_registry rpcGateway)"),
756
798
  rpcUrl: zod.z.string().min(1).optional().describe("JSON-RPC URL; continuum-mcp-server injects from chain registry \u2014 do not pass a public RPC URL"),
@@ -762,12 +804,14 @@ var mcpCurveDaoQuoteInputSchema = zod.z.object({
762
804
  var mcpCurveDaoQuoteOutputSchema = jsonObjectSchema.describe(
763
805
  "Curve router quote: { inputAmount, output, route, priceImpactPercent?, tokenInRouterId, tokenOutRouterId }"
764
806
  );
765
- var mcpCurveDaoBuildSwapMultisignInputSchema = evmMultisignCommonInputSchema.extend({
766
- tokenIn: evmAddressSchema.describe("ERC-20 sold (native in uses WETH path in UI)"),
767
- tokenOut: zod.z.string().min(1).describe("Output token or 0xeeee\u2026 native placeholder"),
768
- amountHuman: zod.z.string().min(1).describe("Human-readable amount of tokenIn"),
769
- slippagePercent: zod.z.number().gt(0).lt(100).describe("Slippage 0\u2013100 exclusive")
770
- });
807
+ var mcpCurveDaoBuildSwapMultisignInputSchema = withMultisignKeySourceRefine(
808
+ evmMultisignCommonInputSchema.extend({
809
+ tokenIn: evmAddressSchema.describe("ERC-20 sold (native in uses WETH path in UI)"),
810
+ tokenOut: zod.z.string().min(1).describe("Output token or 0xeeee\u2026 native placeholder"),
811
+ amountHuman: zod.z.string().min(1).describe("Human-readable amount of tokenIn"),
812
+ slippagePercent: zod.z.number().gt(0).lt(100).describe("Slippage 0\u2013100 exclusive")
813
+ })
814
+ );
771
815
  var mcpServerCommonInputSchema = zod.z.object({
772
816
  keyGenId: zod.z.string().min(1).describe("KeyGen id from fetch_key_gen_result / node preferred KeyGen"),
773
817
  chainId: zod.z.number().int().positive().describe("EVM chain id; RPC and gas config resolved from chain registry"),
@@ -778,7 +822,11 @@ function mcpServerMultisignInput(fields) {
778
822
  return mcpServerCommonInputSchema.extend(fields);
779
823
  }
780
824
  var mcpServerSubmitOutputSchema = zod.z.object({
781
- requestId: zod.z.string().min(1).describe("Sign request id from POST /multiSignRequest \u2014 success; do not retry the same build tool.")
825
+ requestId: zod.z.string().min(1).describe("Sign request id from POST /multiSignRequest \u2014 success; do not retry the same build tool."),
826
+ status: zod.z.literal("submitted").optional().describe("Present when POST /multiSignRequest succeeded. Confirms the request exists on the node."),
827
+ followUp: zod.z.string().optional().describe(
828
+ "Next MCP lifecycle steps. Do not call the same build_*_multisign tool again unless the user explicitly wants a duplicate order."
829
+ )
782
830
  }).describe(
783
831
  "Submitted mpc-auth multiSignRequest. Continue with wait_for_sign_request_ready \u2192 sign_request_agree \u2192 trigger_sign_result \u2192 broadcast_sign_result."
784
832
  );
@@ -789,7 +837,7 @@ var MCP_NON_SUBMIT_TOOL_NAMES = /* @__PURE__ */ new Set([
789
837
 
790
838
  // src/agent/schemas/protocols.ts
791
839
  function mcpMultisignInput(fields) {
792
- return evmMultisignCommonInputSchema.extend(fields);
840
+ return withMultisignKeySourceRefine(evmMultisignCommonInputSchema.extend(fields));
793
841
  }
794
842
  var mcpLidoSubmitInputSchema = mcpMultisignInput({
795
843
  valueWei: zod.z.string().min(1).describe("ETH to stake (wei decimal string)"),
@@ -996,7 +1044,7 @@ var mcpMorphoFetchEarnVaultsOutputSchema = zod.z.object({
996
1044
  )
997
1045
  });
998
1046
  function mcpGmxMultisignInput(fields) {
999
- return evmMultisignCommonInputSchema.extend(fields);
1047
+ return withMultisignKeySourceRefine(evmMultisignCommonInputSchema.extend(fields));
1000
1048
  }
1001
1049
  var gmxDirectionSchema = zod.z.enum(["long", "short"]);
1002
1050
  var gmxOrderTypeSchema = zod.z.enum(["market", "limit"]);
@@ -1144,7 +1192,7 @@ var mcpGmxFetchOhlcvOutputSchema = zod.z.object({
1144
1192
  candles: zod.z.array(gmxOhlcvCandleSchema)
1145
1193
  });
1146
1194
  function mcpHyperliquidMultisignInput(fields) {
1147
- return evmMultisignCommonInputSchema.extend(fields);
1195
+ return withMultisignKeySourceRefine(evmMultisignCommonInputSchema.extend(fields));
1148
1196
  }
1149
1197
  var hyperliquidTifSchema = zod.z.enum(["alo", "gtc", "ioc"]);
1150
1198
  var hyperliquidOhlcvIntervalSchema = zod.z.enum([
@@ -1457,7 +1505,7 @@ function defineProtocolMcpTool(def) {
1457
1505
  description: meta.description,
1458
1506
  followUp: meta.followUp,
1459
1507
  outputZod: mcpServerSubmitOutputSchema,
1460
- inputSchema: zodSchemaToMcpJsonSchema(def.inputZod),
1508
+ inputSchema: agentFacingMultisignJsonSchema(def.inputZod),
1461
1509
  outputSchema: zodSchemaToMcpJsonSchema(mcpServerSubmitOutputSchema),
1462
1510
  parseInput: (data) => def.inputZod.parse(data),
1463
1511
  parseOutput: (data) => mcpServerSubmitOutputSchema.parse(data)
@@ -2018,12 +2066,16 @@ function defineMcpTool(def) {
2018
2066
  }
2019
2067
  function defineMultisignSubmitMcpTool(def) {
2020
2068
  const meta = withMultisignSubmitMcpMeta(def.description, def.followUp ?? MCP_MULTISIGN_SUBMIT_FOLLOW_UP);
2021
- return defineMcpTool({
2069
+ return {
2022
2070
  ...def,
2023
2071
  description: meta.description,
2024
2072
  followUp: meta.followUp,
2025
- outputZod: mcpServerSubmitOutputSchema
2026
- });
2073
+ outputZod: mcpServerSubmitOutputSchema,
2074
+ inputSchema: agentFacingMultisignJsonSchema(def.inputZod),
2075
+ outputSchema: zodSchemaToMcpJsonSchema(mcpServerSubmitOutputSchema),
2076
+ parseInput: (data) => def.inputZod.parse(data),
2077
+ parseOutput: (data) => mcpServerSubmitOutputSchema.parse(data)
2078
+ };
2027
2079
  }
2028
2080
  var CORE_MCP_TOOL_DEFINITIONS = [
2029
2081
  defineMcpTool({