@continuumdao/ctm-mpc-defi 0.2.11 → 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 +96 -47
  2. package/dist/agent/catalog.cjs.map +1 -1
  3. package/dist/agent/catalog.d.ts +879 -339
  4. package/dist/agent/catalog.js +96 -47
  5. package/dist/agent/catalog.js.map +1 -1
  6. package/dist/agent/skills/morpho/SKILL.md +8 -0
  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",
@@ -524,23 +548,30 @@ var chainDetailSchema = zod.z.object({
524
548
  );
525
549
  var evmMultisignCommonInputSchema = zod.z.object({
526
550
  keyGenId: zod.z.string().min(1).optional().describe(
527
- "KeyGen request id from get_preferred_key_gen / conversation context. MCP server resolves keyGen, executorAddress, rpcUrl, and chainDetail \u2014 do not pass those fields when keyGenId is set."
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."
528
552
  ),
529
- keyGen: keyGenSchema,
553
+ keyGen: keyGenSchema.optional().describe("Server-filled from keyGenId. Agents must not pass keyGen."),
530
554
  purposeText: zod.z.string().min(1).describe(
531
555
  "Human-readable purpose for the sign request. Stored in bodyForSign.purpose (may be appended with an automatic batch suffix)."
532
556
  ),
533
- useCustomGas: zod.z.boolean().describe(
557
+ useCustomGas: zod.z.boolean().default(false).describe(
534
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."
535
559
  ),
536
560
  chainId: zod.z.number().int().positive().describe("EVM chain id (decimal). Becomes destinationChainID on the sign request."),
537
- rpcUrl: zod.z.string().min(1).describe("HTTPS JSON-RPC URL for gas estimation, nonce, and allowance reads."),
538
- executorAddress: evmAddressSchema.describe(
539
- "MPC wallet address (from keyGen ethereumaddress) \u2014 tx sender for estimates and approvals."
540
- ),
541
- 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."),
542
564
  customGasChainDetails: zod.z.record(zod.z.unknown()).optional().describe("Snapshot written to extraJSON.customGasChainDetails when useCustomGas is true.")
543
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
+ }
544
575
  var multisignOutputSchema = zod.z.object({
545
576
  bodyForSign: zod.z.record(zod.z.unknown()).describe(
546
577
  "POST body fields without clientSig: keyList, pubKey, msgHash, msgRaw, destinationChainID, purpose, extraJSON, proposalTxParams (batch), messageHashes/messageRawBatch when N>1 txs."
@@ -588,18 +619,20 @@ var mcpUniswapV4CreateSwapOutputSchema = zod.z.object({
588
619
  gasFee: zod.z.string().optional()
589
620
  }).passthrough().describe("{ swap: TransactionRequest, requestId?, gasFee? }");
590
621
  var swapTxRequestSchema = jsonObjectSchema.describe("swap field from create_swap response (to, data, value)");
591
- var mcpUniswapV4BuildSwapMultisignInputSchema = evmMultisignCommonInputSchema.extend({
592
- tokenIn: evmAddressSchema.describe("Token in; 0x0 for native ETH"),
593
- swap: swapTxRequestSchema,
594
- createSwapResponse: zod.z.object({
622
+ var mcpUniswapV4BuildSwapMultisignInputSchema = withMultisignKeySourceRefine(
623
+ evmMultisignCommonInputSchema.extend({
624
+ tokenIn: evmAddressSchema.describe("Token in; 0x0 for native ETH"),
595
625
  swap: swapTxRequestSchema,
596
- requestId: zod.z.string().optional(),
597
- gasFee: zod.z.string().optional()
598
- }).passthrough().describe("Full create_swap response"),
599
- fullQuoteSnapshot: jsonObjectSchema.describe("Quote JSON used for the swap"),
600
- swapDeadlineUnix: zod.z.number().describe("Same deadline passed to create_swap"),
601
- slippagePercent: zod.z.number().optional().describe("Extra approve headroom for EXACT_OUTPUT")
602
- });
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
+ );
603
636
  var lpExistingPoolSchema = zod.z.object({
604
637
  token0Address: evmAddressSchema,
605
638
  token1Address: evmAddressSchema,
@@ -739,21 +772,27 @@ var lpBuildCommonSchema = {
739
772
  nativeWrapped: evmAddressSchema.optional(),
740
773
  poolReference: zod.z.string().optional()
741
774
  };
742
- var mcpUniswapV4BuildMintLiquidityMultisignInputSchema = evmMultisignCommonInputSchema.extend(
743
- 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
+ })
744
795
  );
745
- var mcpUniswapV4BuildIncreaseLiquidityMultisignInputSchema = evmMultisignCommonInputSchema.extend({
746
- ...lpBuildCommonSchema,
747
- nftTokenId: zod.z.union([zod.z.string(), zod.z.number()])
748
- });
749
- var mcpUniswapV4BuildDecreaseLiquidityMultisignInputSchema = evmMultisignCommonInputSchema.extend({
750
- ...lpBuildCommonSchema,
751
- nftTokenId: zod.z.union([zod.z.string(), zod.z.number()])
752
- });
753
- var mcpUniswapV4BuildCollectFeesMultisignInputSchema = evmMultisignCommonInputSchema.extend({
754
- ...lpBuildCommonSchema,
755
- nftTokenId: zod.z.union([zod.z.string(), zod.z.number()])
756
- });
757
796
  var mcpCurveDaoQuoteInputSchema = zod.z.object({
758
797
  chainId: zod.z.number().int().positive().describe("EVM chain id (rpcUrl resolved from get_chain_registry rpcGateway)"),
759
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"),
@@ -765,12 +804,14 @@ var mcpCurveDaoQuoteInputSchema = zod.z.object({
765
804
  var mcpCurveDaoQuoteOutputSchema = jsonObjectSchema.describe(
766
805
  "Curve router quote: { inputAmount, output, route, priceImpactPercent?, tokenInRouterId, tokenOutRouterId }"
767
806
  );
768
- var mcpCurveDaoBuildSwapMultisignInputSchema = evmMultisignCommonInputSchema.extend({
769
- tokenIn: evmAddressSchema.describe("ERC-20 sold (native in uses WETH path in UI)"),
770
- tokenOut: zod.z.string().min(1).describe("Output token or 0xeeee\u2026 native placeholder"),
771
- amountHuman: zod.z.string().min(1).describe("Human-readable amount of tokenIn"),
772
- slippagePercent: zod.z.number().gt(0).lt(100).describe("Slippage 0\u2013100 exclusive")
773
- });
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
+ );
774
815
  var mcpServerCommonInputSchema = zod.z.object({
775
816
  keyGenId: zod.z.string().min(1).describe("KeyGen id from fetch_key_gen_result / node preferred KeyGen"),
776
817
  chainId: zod.z.number().int().positive().describe("EVM chain id; RPC and gas config resolved from chain registry"),
@@ -781,7 +822,11 @@ function mcpServerMultisignInput(fields) {
781
822
  return mcpServerCommonInputSchema.extend(fields);
782
823
  }
783
824
  var mcpServerSubmitOutputSchema = zod.z.object({
784
- 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
+ )
785
830
  }).describe(
786
831
  "Submitted mpc-auth multiSignRequest. Continue with wait_for_sign_request_ready \u2192 sign_request_agree \u2192 trigger_sign_result \u2192 broadcast_sign_result."
787
832
  );
@@ -792,7 +837,7 @@ var MCP_NON_SUBMIT_TOOL_NAMES = /* @__PURE__ */ new Set([
792
837
 
793
838
  // src/agent/schemas/protocols.ts
794
839
  function mcpMultisignInput(fields) {
795
- return evmMultisignCommonInputSchema.extend(fields);
840
+ return withMultisignKeySourceRefine(evmMultisignCommonInputSchema.extend(fields));
796
841
  }
797
842
  var mcpLidoSubmitInputSchema = mcpMultisignInput({
798
843
  valueWei: zod.z.string().min(1).describe("ETH to stake (wei decimal string)"),
@@ -999,7 +1044,7 @@ var mcpMorphoFetchEarnVaultsOutputSchema = zod.z.object({
999
1044
  )
1000
1045
  });
1001
1046
  function mcpGmxMultisignInput(fields) {
1002
- return evmMultisignCommonInputSchema.extend(fields);
1047
+ return withMultisignKeySourceRefine(evmMultisignCommonInputSchema.extend(fields));
1003
1048
  }
1004
1049
  var gmxDirectionSchema = zod.z.enum(["long", "short"]);
1005
1050
  var gmxOrderTypeSchema = zod.z.enum(["market", "limit"]);
@@ -1147,7 +1192,7 @@ var mcpGmxFetchOhlcvOutputSchema = zod.z.object({
1147
1192
  candles: zod.z.array(gmxOhlcvCandleSchema)
1148
1193
  });
1149
1194
  function mcpHyperliquidMultisignInput(fields) {
1150
- return evmMultisignCommonInputSchema.extend(fields);
1195
+ return withMultisignKeySourceRefine(evmMultisignCommonInputSchema.extend(fields));
1151
1196
  }
1152
1197
  var hyperliquidTifSchema = zod.z.enum(["alo", "gtc", "ioc"]);
1153
1198
  var hyperliquidOhlcvIntervalSchema = zod.z.enum([
@@ -1460,7 +1505,7 @@ function defineProtocolMcpTool(def) {
1460
1505
  description: meta.description,
1461
1506
  followUp: meta.followUp,
1462
1507
  outputZod: mcpServerSubmitOutputSchema,
1463
- inputSchema: zodSchemaToMcpJsonSchema(def.inputZod),
1508
+ inputSchema: agentFacingMultisignJsonSchema(def.inputZod),
1464
1509
  outputSchema: zodSchemaToMcpJsonSchema(mcpServerSubmitOutputSchema),
1465
1510
  parseInput: (data) => def.inputZod.parse(data),
1466
1511
  parseOutput: (data) => mcpServerSubmitOutputSchema.parse(data)
@@ -2021,12 +2066,16 @@ function defineMcpTool(def) {
2021
2066
  }
2022
2067
  function defineMultisignSubmitMcpTool(def) {
2023
2068
  const meta = withMultisignSubmitMcpMeta(def.description, def.followUp ?? MCP_MULTISIGN_SUBMIT_FOLLOW_UP);
2024
- return defineMcpTool({
2069
+ return {
2025
2070
  ...def,
2026
2071
  description: meta.description,
2027
2072
  followUp: meta.followUp,
2028
- outputZod: mcpServerSubmitOutputSchema
2029
- });
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
+ };
2030
2079
  }
2031
2080
  var CORE_MCP_TOOL_DEFINITIONS = [
2032
2081
  defineMcpTool({